support different wifi bt chip auto compatible, modify
[firefly-linux-kernel-4.4.55.git] / arch / arm64 / boot / dts / rk3368-p9_818.dts
1 /dts-v1/;
2
3 #include <dt-bindings/interrupt-controller/arm-gic.h>
4 #include <dt-bindings/rkfb/rk_fb.h>
5 #include "rk3368.dtsi"
6 #include "../../../arm/boot/dts/lcd-ld089wu1-mipi.dtsi"
7 / {
8         chosen {
9                 bootargs = "earlyprintk=uart8250-32bit,0xff690000 clk_ignore_unused";
10         };
11
12         wireless-wlan {
13                 compatible = "wlan-platdata";
14
15                 rockchip,grf = <&grf>;
16
17                 /* wifi_chip_type - wifi chip define
18                  * ap6210, ap6330, ap6335
19                  * rtl8188eu, rtl8723bs, rtl8723bu
20                  * esp8089
21                 */
22                 wifi_chip_type = "ap6210";              
23
24                 sdio_vref = <1800>; //1800mv or 3300mv
25                 power_pmu_regulator = "rk818_ldo8_reg";
26                 power_pmu_enable_level = <1>; //1->HIGH, 0->LOW
27                 vref_pmu_regulator = "rk818_ldo8_reg";
28                 vref_pmu_enable_level = <1>; //1->HIGH, 0->LOW
29
30                 WIFI,poweren_gpio = <&gpio3 GPIO_A4 GPIO_ACTIVE_HIGH>;
31                 WIFI,host_wake_irq = <&gpio3 GPIO_A6 GPIO_ACTIVE_HIGH>;
32
33                 status = "okay";
34         };
35
36         wireless-bluetooth {
37                 compatible = "bluetooth-platdata";
38                 uart_rts_gpios = <&gpio2 GPIO_D3 GPIO_ACTIVE_LOW>;
39                 pinctrl-names = "default","rts_gpio";
40                 pinctrl-0 = <&uart0_rts>;
41                 pinctrl-1 = <&uart0_rts_gpio>;
42
43                 BT,power_gpio = <&gpio3 GPIO_A3 GPIO_ACTIVE_HIGH>;
44                 BT,reset_gpio = <&gpio3 GPIO_A5 GPIO_ACTIVE_HIGH>;
45                 BT,wake_gpio = <&gpio3 GPIO_A2 GPIO_ACTIVE_HIGH>;
46                 BT,wake_host_irq = <&gpio3 GPIO_A7 GPIO_ACTIVE_HIGH>;
47
48                 status = "okay";
49         };
50
51         hallsensor {
52                compatible = "hall_och165t";
53                type = <SENSOR_TYPE_HALL>;
54                irq-gpio = <&gpio0 GPIO_C0 IRQ_TYPE_EDGE_BOTH>;
55         };
56
57         backlight {
58                 compatible = "pwm-backlight";
59                 pwms = <&pwm0 0 25000>;
60                 brightness-levels = <255 254 253 252 251 250 249 248 247 246 245 244 243 242 241 240
61                      239 238 237 236 235 234 233 232 231 230 229 228 227 226 225 224 223 222 221 220
62                      219 218 217 216 215 214 213 212 211 210 209 208 207 206 205 204 203 202 201 200
63                      199 198 197 196 195 194 193 192 191 190 189 188 187 186 185 184 183 182 181 180
64                      179 178 177 176 175 174 173 172 171 170 169 168 167 166 165 164 163 162 161 160
65                      159 158 157 156 155 154 153 152 151 150 149 148 147 146 145 144 143 142 141 140
66                      139 138 137 136 135 134 133 132 131 130 129 128 127 126 125 124 123 122 121 120
67                      119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100
68                      99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70
69                      69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40
70                      39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
71                      9 8 7 6 5 4 3 2 1 0>;
72                 default-brightness-level = <200>;
73                 enable-gpios = <&gpio0 GPIO_C4 GPIO_ACTIVE_HIGH>;
74         };
75
76         pwm_regulator {
77                 compatible = "rockchip_pwm_regulator";
78                 pwms = <&pwm1 0 2000>;
79                 rockchip,pwm_id= <1>;
80                 rockchip,pwm_voltage_map= <925000 950000 975000 1000000 1025000 1050000 1075000 1100000 1125000 1150000 1175000 1200000 1225000 1250000 1275000 1300000 1325000 1350000 1375000 1400000>;
81                 rockchip,pwm_voltage= <1000000>;
82                 rockchip,pwm_min_voltage= <925000>;
83                 rockchip,pwm_max_voltage= <1400000>;
84                 rockchip,pwm_suspend_voltage= <950000>;
85                 rockchip,pwm_coefficient= <475>;
86                 regulators {
87                         #address-cells = <1>;
88                         #size-cells = <0>;
89                         pwm_reg0: regulator@0 {
90                                 regulator-compatible = "pwm_dcdc1";
91                                 regulator-name= "vdd_logic";
92                                 regulator-min-microvolt = <925000>;
93                                 regulator-max-microvolt = <1400000>;
94                                 regulator-always-on;
95                                 regulator-boot-on;
96                         };
97                 };
98         };
99
100         codec_hdmi_i2s: codec-hdmi-i2s {
101                 compatible = "hdmi-i2s";
102         };
103
104         codec_hdmi_spdif: codec-hdmi-spdif {
105                 compatible = "hdmi-spdif";
106         };
107
108         rockchip-hdmi-i2s {
109                 compatible = "rockchip-hdmi-i2s";
110                 dais {
111                         dai0 {
112                                 audio-codec = <&codec_hdmi_i2s>;
113                                 i2s-controller = <&i2s0>;
114                                 format = "i2s";
115                         };
116                 };
117         };
118
119         rockchip-hdmi-spdif {
120                 compatible = "rockchip-hdmi-spdif";
121                 dais {
122                         dai0 {
123                                 audio-codec = <&codec_hdmi_spdif>;
124                                 i2s-controller = <&spdif>;
125                         };
126                 };
127         };
128
129         rockchip-es8316 {
130                 compatible = "rockchip-es8316";
131                 dais {
132                         dai0 {
133                                 audio-codec = <&es8316>;
134                                 i2s-controller = <&i2s0>;
135                                 format = "i2s";
136                         };
137                 };
138         };
139
140         io-domains {
141                 compatible = "rockchip,rk3368-io-voltage-domain";
142                 rockchip,grf = <&grf>;
143                 rockchip,pmugrf = <&pmugrf>;
144
145                 /*GRF_IO_VSEL*/
146                 gpio30-supply = <&rk818_dcdc4_reg>;     /*APIO1_VDD*/
147                 wifi-supply = <&rk818_ldo8_reg>;     /*APIO2_VDD*/
148                 audio-supply = <&rk818_dcdc4_reg>;   /*APIO3_VDD*/
149                 gpio1830-supply = <&rk818_dcdc4_reg>;   /*ADIO4_VDD*/
150                 sdcard-supply = <&rk818_ldo9_reg>;   /*SDMMC_VDD*/
151
152                 /*PMU_GRF_IO_VSEL*/
153                 pmu-supply = <&rk818_ldo5_reg>;      /*PMUIO_VDD*/
154                 vop-supply = <&rk818_ldo5_reg>;      /*LCDC_VDD*/
155         };
156 };
157
158 &pinctrl {
159         //used for init some gpio
160         init-gpios = <&gpio0 GPIO_A6 GPIO_ACTIVE_HIGH>;
161
162         gpio0_gpio {
163                         gpio0_c7: gpio0-c7 {
164                                 rockchip,pins = <0 GPIO_C7 RK_FUNC_GPIO &pcfg_pull_down>;
165                         };
166                         gpio0_a3: gpio0-a3 {
167                                 rockchip,pins = <0 GPIO_A3 RK_FUNC_3 &pcfg_pull_none>;
168                         };
169                         gpio0_c2: gpio0-c2 {
170                                 rockchip,pins = <0 GPIO_C2 RK_FUNC_GPIO &pcfg_pull_down>;
171                         };
172
173                         //to add
174                 };
175
176 };
177
178 &nandc0 {
179         status = "disabled"; // used nand set "disabled" ,used emmc set "okay"
180 };
181
182 &nandc0reg {
183         status = "okay"; // used nand set "disabled" ,used emmc set "okay"
184 };
185
186 &emmc {
187         clock-frequency = <150000000>;
188         clock-freq-min-max = <400000 150000000>;
189
190         supports-highspeed;
191         supports-emmc;
192         bootpart-no-access;
193
194         //supports-tSD;
195         supports-DDR_MODE; //you should set the two value in your project. only close in RK3288-SDK board.
196         caps2-mmc-hs200;
197
198         ignore-pm-notify;
199         keep-power-in-suspend;
200
201         //poll-hw-reset
202         status = "okay";
203 };
204
205 &sdmmc {
206         clock-frequency = <50000000>;
207         clock-freq-min-max = <400000 50000000>;
208         supports-highspeed;
209         supports-sd;
210         broken-cd;
211         card-detect-delay = <200>;
212
213         ignore-pm-notify;
214         keep-power-in-suspend;
215
216         vmmc-supply = <&rk818_ldo1_reg>;
217                 status = "okay";
218 };
219
220 &sdio {
221         clock-frequency = <50000000>;
222         clock-freq-min-max = <200000 50000000>;
223         supports-highspeed;
224         supports-sdio;
225         ignore-pm-notify;
226         keep-power-in-suspend;
227         //cap-sdio-irq;
228         status = "okay";
229 };
230
231 &spi0 {
232         status = "disabled";
233 };
234
235 &spi1 {
236         status = "disabled";
237 };
238
239 &spi2 {
240         status = "disabled";
241 };
242
243 &uart_dbg {
244         status = "okay";
245 };
246
247 &uart_bt {
248         status = "okay";
249         dma-names = "!tx", "!rx";
250         pinctrl-0 = <&uart0_xfer &uart0_cts>;
251 };
252
253 &i2c0 {
254         status = "okay";
255         syr827: syr827@40 {
256                 compatible = "silergy,syr82x";
257                 reg = <0x40>;
258                 status = "okay";
259                 regulators {
260                         #address-cells = <1>;
261                         #size-cells = <0>;
262                         syr827_dc1: regulator@0 {
263                         reg = <0>;
264                         regulator-compatible = "syr82x_dcdc1";
265                         regulator-name = "vdd_arm";
266                         regulator-min-microvolt = <712500>;
267                         regulator-max-microvolt = <1500000>;
268                         regulator-always-on;
269                         regulator-boot-on;
270                         regulator-initial-mode = <0x2>;
271                         regulator-initial-state = <3>;
272                         regulator-state-mem {
273                                 regulator-state-mode = <0x2>;
274                                 regulator-state-disabled;
275                                 regulator-state-uv = <900000>;
276                         };
277                 };
278            };
279         };
280         syr828: syr828@41 {
281                 compatible = "silergy,syr82x";
282                 reg = <0x41>;
283                 status = "okay";
284                 regulators {
285                         #address-cells = <1>;
286                         #size-cells = <0>;
287                         syr828_dc1: regulator@0 {
288                         reg = <0>;
289                         regulator-compatible = "syr82x_dcdc1";
290                         regulator-name = "vdd_gpu";
291                         regulator-min-microvolt = <712500>;
292                         regulator-max-microvolt = <1500000>;
293                         regulator-always-on;
294                         regulator-boot-on;
295                         regulator-initial-mode = <0x2>;
296                         regulator-initial-state = <3>;
297                         regulator-state-mem {
298                                 regulator-state-mode = <0x2>;
299                                 regulator-state-enabled;
300                                 regulator-state-uv = <900000>;
301                         };
302                 };
303            };
304         };
305
306         rk818: rk818@1c {
307                 reg = <0x1c>;
308                 status = "okay";
309                 compatible = "rockchip,rk818";
310                 battery {
311                         ocv_table = <3300 3599 3671 3701 3728 3746 3762
312                                      3772 3781 3792 3816 3836 3866 3910
313                                      3942 3971 4002 4050 4088 4132 4183>;
314                         design_capacity = <3914>;
315                         design_qmax = <4000>;
316                         max_overcharge = <100>;
317                         max_charge_currentmA = <1500>;
318                         max_charge_voltagemV = <4260>;
319                         max_bat_voltagemV = <4200>;
320                         sleep_enter_current = <150>;
321                         sleep_exit_current = <180>;
322                 };
323         };
324 };
325
326 &i2c1 {
327         status = "okay";
328         es8316: es8316@10 {
329                 compatible = "es8316";
330                 reg = <0x10>;
331                 status = "okay";
332         };
333 };
334
335 &i2c2 {
336         status = "okay";
337         touchscreen@14 {
338                 compatible = "goodix,gt9xx";
339                 reg = <0x14>;
340                 touch-gpio = <&gpio0 GPIO_B4 IRQ_TYPE_LEVEL_LOW>;
341                 reset-gpio = <&gpio0 GPIO_B3 GPIO_ACTIVE_HIGH>;  
342                 max-x = <1920>;                  
343                 max-y = <1200>;
344                 tp-size = <89>;
345         };
346 };
347
348 &i2c3 {
349         status = "okay";
350 };
351
352 &i2c4 {
353         status = "okay";
354
355         mpu6050:mpu@68{
356                 compatible = "mpu6050";
357                 reg = <0x68>;
358                 mpu-int_config = <0x10>;
359                 mpu-level_shifter = <0>;
360                 mpu-orientation = <0 1 0 1 0 0 0 0 1>;
361                 orientation-x= <0>;
362                 orientation-y= <1>;
363                 orientation-z= <1>;
364                 irq-gpio = <&gpio3 GPIO_B6 IRQ_TYPE_LEVEL_LOW>;
365                 mpu-debug = <0>;
366         };
367
368
369         ak8963:compass@0d{
370                 compatible = "mpu_ak8963";
371                 reg = <0x0d>;
372                 compass-bus = <0>;
373                 compass-adapt_num = <0>;
374                 compass-orientation = <1 0 0 0 1 0 0 0 1>;
375                 orientation-x= <0>;
376                 orientation-y= <0>;
377                 orientation-z= <1>;
378                 compass-debug = <1>;
379                 status = "okay";
380         };
381
382 };
383
384 &i2c5 {
385         status = "disabled";
386 };
387
388 &fb {
389         status = "okay";
390         rockchip,disp-mode = <NO_DUAL>;
391         rockchip,uboot-logo-on = <0>;
392 };
393
394 &rk_screen {
395         status = "okay";
396         display-timings = <&disp_timings>;
397 };
398
399 &lcdc {
400         status = "okay";
401         rockchip,mirror = <NO_MIRROR>;
402         rockchip,cabc_mode = <0>;
403         rockchip,fb-win-map = <FB_DEFAULT_ORDER>;
404         power_ctr: power_ctr {
405                 rockchip,debug = <0>;
406                 lcd_en:lcd_en {
407                         rockchip,power_type = <GPIO>;
408                         gpios = <&gpio0 GPIO_C6 GPIO_ACTIVE_HIGH>;
409                         rockchip,delay = <120>;
410                 };
411
412                 lcd_cs:lcd_cs {
413                         rockchip,power_type = <GPIO>;
414                         gpios = <&gpio0 GPIO_C5 GPIO_ACTIVE_HIGH>;
415                         rockchip,delay = <10>;
416                 };
417
418                 /*lcd_rst:lcd_rst {
419                         rockchip,power_type = <GPIO>;
420                         gpios = <&gpio3 GPIO_D6 GPIO_ACTIVE_HIGH>;
421                         rockchip,delay = <5>;
422                 };*/
423         };
424 };
425
426
427 &hdmi {
428         status = "okay";
429         rockchips,hdmi_audio_source = <0>;
430 };
431
432 &adc {
433         status = "okay";
434
435         rockchip_headset {
436                 compatible = "rockchip_headset";
437                 headset_gpio = <&gpio0 GPIO_C7 GPIO_ACTIVE_LOW>;
438                 pinctrl-names = "default";
439                 pinctrl-0 = <&gpio0_c7>;//gpio0_c7
440                 io-channels = <&adc 2>;
441        /*
442                hook_gpio = ;
443                hook_down_type = ; //interrupt hook key down status
444                 */
445        };
446
447         key {
448                 compatible = "rockchip,key";
449                 io-channels = <&adc 1>;
450
451                 vol-up-key {
452                         linux,code = <115>;
453                         label = "volume up";
454                         rockchip,adc_value = <1>;
455                 };
456
457                 vol-down-key {
458                         linux,code = <114>;
459                         label = "volume down";
460                         rockchip,adc_value = <170>;
461                 };
462
463                 power-key {
464                         gpios = <&gpio0 GPIO_A2 GPIO_ACTIVE_LOW>;
465                         linux,code = <116>;
466                         label = "power";
467                         gpio-key,wakeup;
468                 };
469         };
470 };
471
472 &pwm0 {
473         status = "okay";
474 };
475
476 &pwm1 {
477         status = "disabled";
478 };
479
480 &clk_ddr_dvfs_table {
481         operating-points = <
482                 /* KHz    uV */
483                 200000 1100000
484                 300000 1100000
485                 400000 1100000
486                 533000 1150000
487                 >;
488
489         freq-table = <
490                 /*status                freq(KHz)*/
491                 SYS_STATUS_NORMAL       400000
492                 SYS_STATUS_SUSPEND      200000
493                 SYS_STATUS_VIDEO_1080P  240000
494                 SYS_STATUS_VIDEO_4K     400000
495                 SYS_STATUS_PERFORMANCE  528000
496                 SYS_STATUS_DUALVIEW     400000
497                 SYS_STATUS_BOOST        324000
498                 SYS_STATUS_ISP          400000
499                 >;
500         auto-freq-table = <
501                 240000
502                 324000
503                 396000
504                 528000
505                 >;
506         auto-freq=<0>;
507         status="disabled";
508 };
509
510 &dwc_control_usb {
511         host_drv_gpio = <&gpio0 GPIO_A4 GPIO_ACTIVE_LOW>;
512         otg_drv_gpio = <&gpio0 GPIO_D1 GPIO_ACTIVE_LOW>;
513         rockchip,remote_wakeup;
514         rockchip,usb_irq_wakeup;
515 };
516
517 /include/ "../../../arm/boot/dts/rk818.dtsi"
518 &rk818 {
519         gpios =<&gpio0 GPIO_A1 GPIO_ACTIVE_HIGH>,<&gpio0 GPIO_A0 GPIO_ACTIVE_LOW>;
520         rk818,system-power-controller;
521         
522         regulators {
523
524                 rk818_dcdc1_reg: regulator@0{
525                         regulator-name= "vdd_arm";/*vcc arm*/
526                         regulator-min-microvolt = <700000>;/*<725000>;*/
527                         regulator-max-microvolt = <1500000>;
528                         regulator-initial-mode = <0x2>;
529                         regulator-initial-state = <3>;
530                         regulator-state-mem {
531                                 regulator-state-mode = <0x2>;
532                                 regulator-state-enabled;
533                                 regulator-state-uv =<900000>;
534                         };
535                 };
536
537                 rk818_dcdc2_reg: regulator@1 {
538                         regulator-name= "vdd_gpu";/*vcc gpu*/
539                         regulator-min-microvolt = <700000>;
540                         regulator-max-microvolt = <1200000>;
541                         regulator-initial-mode = <0x2>;
542                         regulator-initial-state = <3>;
543                         regulator-state-mem {
544                                 regulator-state-mode = <0x2>;
545                                 regulator-state-enabled;
546                                 regulator-state-uv = <1200000>;
547                         };
548                 };
549
550                 rk818_dcdc3_reg: regulator@2 {
551                         regulator-name= "vcc_ddr";
552                         regulator-min-microvolt = <1200000>;
553                         regulator-max-microvolt = <1200000>;
554                         regulator-initial-mode = <0x2>;
555                         regulator-initial-state = <3>;
556                         regulator-state-mem {
557                                 regulator-state-mode = <0x2>;
558                                 regulator-state-enabled;
559                                 regulator-state-uv = <1200000>;
560                         };
561                 };
562
563                 rk818_dcdc4_reg: regulator@3 {
564                         regulator-name= "vccio";
565                         regulator-min-microvolt = <3000000>;
566                         regulator-max-microvolt = <3000000>;
567                         regulator-initial-mode = <0x2>;
568                         regulator-initial-state = <3>;
569                         regulator-state-mem {
570                                 regulator-state-mode = <0x2>;
571                                 regulator-state-enabled;
572                                 regulator-state-uv = <3000000>;
573                         };
574                 };
575
576                 rk818_ldo1_reg: regulator@4 {
577                         regulator-name= "vcc_codec";
578                         regulator-min-microvolt = <3300000>;
579                         regulator-max-microvolt = <3300000>;
580                         regulator-initial-state = <3>;
581                         regulator-state-mem {
582                                 regulator-state-enabled;
583                                 regulator-state-uv = <3300000>;
584                         };
585                 };
586
587                 rk818_ldo2_reg: regulator@5 {
588                         regulator-name= "vcc_tp";
589                         regulator-min-microvolt = <3300000>;
590                         regulator-max-microvolt = <3300000>;
591                         regulator-initial-state = <3>;
592                         regulator-state-mem {
593                                 regulator-state-enabled;
594                                 regulator-state-uv = <3300000>;
595                         };
596                 };
597
598                 rk818_ldo3_reg: regulator@6 {
599                         regulator-name= "vdd_10";
600                         regulator-min-microvolt = <1000000>;
601                         regulator-max-microvolt = <1000000>;
602                         regulator-initial-state = <3>;
603                         regulator-state-mem {
604                                 regulator-state-enabled;
605                                 regulator-state-uv = <1000000>;
606                         };
607                 };
608
609                 rk818_ldo4_reg:regulator@7 {
610                         regulator-name= "vcc18_lcd";
611                         regulator-min-microvolt = <1800000>;
612                         regulator-max-microvolt = <1800000>;
613                         regulator-initial-state = <3>;
614                         regulator-state-mem {
615                                 regulator-state-disabled;
616                                 regulator-state-uv = <1800000>;
617                         };
618                 };
619
620                 rk818_ldo5_reg: regulator@8 {
621                         regulator-name= "vccio_pmu";
622                         regulator-min-microvolt = <1800000>;
623                         regulator-max-microvolt = <1800000>;
624                         regulator-initial-state = <3>;
625                         regulator-state-mem {
626                                 regulator-state-enabled;
627                                 regulator-state-uv = <1800000>;
628                         };
629                 };
630
631                 rk818_ldo6_reg: regulator@9 {
632                         regulator-name= "vdd10_lcd";
633                         regulator-min-microvolt = <1000000>;
634                         regulator-max-microvolt = <1000000>;
635                         regulator-initial-state = <3>;
636                         regulator-state-mem {
637                                 regulator-state-disabled;
638                                 regulator-state-uv = <1000000>;
639                         };
640                 };
641
642                 rk818_ldo7_reg: regulator@10 {
643                         regulator-name= "vcc_18";
644                         regulator-min-microvolt = <1800000>;
645                         regulator-max-microvolt = <1800000>;
646                         regulator-initial-state = <3>;
647                         regulator-state-mem {
648                                 regulator-state-enabled;
649                                 regulator-state-uv = <1800000>;
650                         };
651                 };
652
653                 rk818_ldo8_reg: regulator@11 {
654                         regulator-name= "vccio_wl";
655                         regulator-min-microvolt = <1800000>;
656                         regulator-max-microvolt = <1800000>;
657                         regulator-initial-state = <3>;
658                         regulator-state-mem {
659                                 regulator-state-enabled;
660                                 regulator-state-uv = <1800000>;
661                         };
662                 };
663
664                 rk818_ldo9_reg: regulator@12 {
665                         regulator-name= "vcc_sd";
666                         regulator-min-microvolt = <1800000>;
667                         regulator-max-microvolt = <3300000>;
668                         regulator-initial-state = <3>;
669                         regulator-state-mem {
670                                 regulator-state-enabled;
671                                 regulator-state-uv = <3300000>;
672                         };
673                 };
674
675                 rk818_ldo10_reg: regulator@13 {
676                         regulator-name= "rk818_ldo10";
677                         regulator-state-mem {
678                                 regulator-state-disabled;
679                         };
680                 };
681         };
682 };
683
684 &ion_cma {
685        reg = <0x00000000 0x28000000>; /* 640MB */
686 };
687