treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / arch / mips / boot / dts / ingenic / qi_lb60.dts
blob7a371d9c5a33f70ae61adfabb3611715cfee35e3
1 // SPDX-License-Identifier: GPL-2.0
2 /dts-v1/;
4 #include "jz4740.dtsi"
6 #include <dt-bindings/gpio/gpio.h>
7 #include <dt-bindings/iio/adc/ingenic,adc.h>
8 #include <dt-bindings/clock/ingenic,tcu.h>
9 #include <dt-bindings/input/input.h>
11 #define KEY_QI_QI       KEY_F13
12 #define KEY_QI_UPRED    KEY_RIGHTALT
13 #define KEY_QI_VOLUP    KEY_VOLUMEUP
14 #define KEY_QI_VOLDOWN  KEY_VOLUMEDOWN
15 #define KEY_QI_FN       KEY_LEFTCTRL
17 / {
18         compatible = "qi,lb60", "ingenic,jz4740";
20         chosen {
21                 stdout-path = &uart0;
22         };
24         vcc: regulator@0 {
25                 compatible = "regulator-fixed";
26                 regulator-name = "vcc";
28                 regulator-min-microvolt = <3300000>;
29                 regulator-max-microvolt = <3300000>;
30                 regulator-always-on;
31         };
33         mmc_power: regulator@1 {
34                 compatible = "regulator-fixed";
35                 regulator-name = "mmc_vcc";
36                 gpio = <&gpd 2 0>;
38                 regulator-min-microvolt = <3300000>;
39                 regulator-max-microvolt = <3300000>;
40         };
42         amp_supply: regulator@2 {
43                 compatible = "regulator-fixed";
44                 regulator-name = "amp_supply";
45                 gpio = <&gpd 4 0>;
46                 enable-active-high;
48                 regulator-min-microvolt = <3300000>;
49                 regulator-max-microvolt = <3300000>;
50         };
52         amp: analog-amplifier {
53                 compatible = "simple-audio-amplifier";
54                 enable-gpios = <&gpb 29 GPIO_ACTIVE_HIGH>;
55                 VCC-supply = <&amp_supply>;
56         };
58         sound {
59                 compatible = "simple-audio-card";
61                 simple-audio-card,name = "QI LB60";
62                 simple-audio-card,format = "i2s";
64                 simple-audio-card,widgets =
65                         "Speaker", "Speaker",
66                         "Microphone", "Mic";
67                 simple-audio-card,routing =
68                         "MIC", "Mic",
69                         "Speaker", "OUTL",
70                         "Speaker", "OUTR",
71                         "INL", "LOUT",
72                         "INL", "ROUT";
74                 simple-audio-card,aux-devs = <&amp>;
76                 simple-audio-card,bitclock-master = <&dai_codec>;
77                 simple-audio-card,frame-master = <&dai_codec>;
79                 dai_cpu: simple-audio-card,cpu {
80                         sound-dai = <&aic>;
81                 };
83                 dai_codec: simple-audio-card,codec {
84                         sound-dai = <&codec>;
85                 };
86         };
88         keys {
89                 compatible = "gpio-keys";
91                 key {
92                         label = "Power";
93                         wakeup-source;
94                         linux,code = <KEY_POWER>;
95                         gpios = <&gpd 29 GPIO_ACTIVE_LOW>;
96                 };
97         };
99         keyboard {
100                 compatible = "gpio-matrix-keypad";
102                 col-scan-delay-us = <10>;
103                 debounce-delay-ms = <10>;
104                 wakeup-source;
106                 row-gpios = <&gpd 18 0 &gpd 19 0 &gpd 20 0 &gpd 21 0
107                              &gpd 22 0 &gpd 23 0 &gpd 24 0 &gpd 26 0>;
108                 col-gpios = <&gpc 10 0 &gpc 11 0 &gpc 12 0 &gpc 13 0
109                              &gpc 14 0 &gpc 15 0 &gpc 16 0 &gpc 17 0>;
110                 gpio-activelow;
112                 linux,keymap = <
113                         MATRIX_KEY(0, 0, KEY_F1)        /* S2 */
114                         MATRIX_KEY(0, 1, KEY_F2)        /* S3 */
115                         MATRIX_KEY(0, 2, KEY_F3)        /* S4 */
116                         MATRIX_KEY(0, 3, KEY_F4)        /* S5 */
117                         MATRIX_KEY(0, 4, KEY_F5)        /* S6 */
118                         MATRIX_KEY(0, 5, KEY_F6)        /* S7 */
119                         MATRIX_KEY(0, 6, KEY_F7)        /* S8 */
121                         MATRIX_KEY(1, 0, KEY_Q) /* S10 */
122                         MATRIX_KEY(1, 1, KEY_W) /* S11 */
123                         MATRIX_KEY(1, 2, KEY_E) /* S12 */
124                         MATRIX_KEY(1, 3, KEY_R) /* S13 */
125                         MATRIX_KEY(1, 4, KEY_T) /* S14 */
126                         MATRIX_KEY(1, 5, KEY_Y) /* S15 */
127                         MATRIX_KEY(1, 6, KEY_U) /* S16 */
128                         MATRIX_KEY(1, 7, KEY_I) /* S17 */
129                         MATRIX_KEY(2, 0, KEY_A) /* S18 */
130                         MATRIX_KEY(2, 1, KEY_S) /* S19 */
131                         MATRIX_KEY(2, 2, KEY_D) /* S20 */
132                         MATRIX_KEY(2, 3, KEY_F) /* S21 */
133                         MATRIX_KEY(2, 4, KEY_G) /* S22 */
134                         MATRIX_KEY(2, 5, KEY_H) /* S23 */
135                         MATRIX_KEY(2, 6, KEY_J) /* S24 */
136                         MATRIX_KEY(2, 7, KEY_K) /* S25 */
137                         MATRIX_KEY(3, 0, KEY_ESC)       /* S26 */
138                         MATRIX_KEY(3, 1, KEY_Z) /* S27 */
139                         MATRIX_KEY(3, 2, KEY_X) /* S28 */
140                         MATRIX_KEY(3, 3, KEY_C) /* S29 */
141                         MATRIX_KEY(3, 4, KEY_V) /* S30 */
142                         MATRIX_KEY(3, 5, KEY_B) /* S31 */
143                         MATRIX_KEY(3, 6, KEY_N) /* S32 */
144                         MATRIX_KEY(3, 7, KEY_M) /* S33 */
145                         MATRIX_KEY(4, 0, KEY_TAB)       /* S34 */
146                         MATRIX_KEY(4, 1, KEY_CAPSLOCK)  /* S35 */
147                         MATRIX_KEY(4, 2, KEY_BACKSLASH) /* S36 */
148                         MATRIX_KEY(4, 3, KEY_APOSTROPHE)        /* S37 */
149                         MATRIX_KEY(4, 4, KEY_COMMA)     /* S38 */
150                         MATRIX_KEY(4, 5, KEY_DOT)       /* S39 */
151                         MATRIX_KEY(4, 6, KEY_SLASH)     /* S40 */
152                         MATRIX_KEY(4, 7, KEY_UP)        /* S41 */
153                         MATRIX_KEY(5, 0, KEY_O) /* S42 */
154                         MATRIX_KEY(5, 1, KEY_L) /* S43 */
155                         MATRIX_KEY(5, 2, KEY_EQUAL)     /* S44 */
156                         MATRIX_KEY(5, 3, KEY_QI_UPRED)  /* S45 */
157                         MATRIX_KEY(5, 4, KEY_SPACE)     /* S46 */
158                         MATRIX_KEY(5, 5, KEY_QI_QI)     /* S47 */
159                         MATRIX_KEY(5, 6, KEY_RIGHTCTRL) /* S48 */
160                         MATRIX_KEY(5, 7, KEY_LEFT)      /* S49 */
161                         MATRIX_KEY(6, 0, KEY_F8)        /* S50 */
162                         MATRIX_KEY(6, 1, KEY_P) /* S51 */
163                         MATRIX_KEY(6, 2, KEY_BACKSPACE)/* S52 */
164                         MATRIX_KEY(6, 3, KEY_ENTER)     /* S53 */
165                         MATRIX_KEY(6, 4, KEY_QI_VOLUP)  /* S54 */
166                         MATRIX_KEY(6, 5, KEY_QI_VOLDOWN)        /* S55 */
167                         MATRIX_KEY(6, 6, KEY_DOWN)      /* S56 */
168                         MATRIX_KEY(6, 7, KEY_RIGHT)     /* S57 */
170                         MATRIX_KEY(7, 0, KEY_LEFTSHIFT) /* S58 */
171                         MATRIX_KEY(7, 1, KEY_LEFTALT) /* S59 */
172                         MATRIX_KEY(7, 2, KEY_QI_FN)     /* S60 */
173                         >;
174         };
176         spi {
177                 compatible = "spi-gpio";
178                 #address-cells = <1>;
179                 #size-cells = <0>;
181                 sck-gpios = <&gpc 23 GPIO_ACTIVE_HIGH>;
182                 mosi-gpios = <&gpc 22 GPIO_ACTIVE_HIGH>;
183                 cs-gpios = <&gpc 21 GPIO_ACTIVE_LOW>;
184                 num-chipselects = <1>;
185         };
187         usb_charger: charger {
188                 compatible = "gpio-charger";
189                 charger-type = "usb-sdp";
190                 gpios = <&gpd 28 GPIO_ACTIVE_LOW>;
191                 status-gpios = <&gpc 27 GPIO_ACTIVE_LOW>;
192         };
194         simple_battery: battery {
195                 compatible = "simple-battery";
196                 voltage-min-design-microvolt = <3600000>;
197                 voltage-max-design-microvolt = <4200000>;
198         };
200         pmu {
201                 compatible = "ingenic,jz4740-battery";
202                 io-channels = <&adc INGENIC_ADC_BATTERY>;
203                 io-channel-names = "battery";
204                 power-supplies = <&usb_charger>;
205                 monitored-battery = <&simple_battery>;
206         };
208         hwmon {
209                 compatible = "iio-hwmon";
210                 io-channels = <&adc INGENIC_ADC_AUX>;
211         };
213         panel: panel {
214                 compatible = "giantplus,gpm940b0";
216                 power-supply = <&vcc>;
218                 port {
219                         panel_input: endpoint {
220                                 remote-endpoint = <&panel_output>;
221                         };
222                 };
223         };
225         usb_phy: usb-phy {
226                 compatible = "usb-nop-xceiv";
227                 #phy-cells = <0>;
229                 vcc-supply = <&vcc>;
230         };
233 &ext {
234         clock-frequency = <12000000>;
237 &rtc_dev {
238         system-power-controller;
241 &uart0 {
242         pinctrl-names = "default";
243         pinctrl-0 = <&pins_uart0>;
246 &uart1 {
247         status = "disabled";
250 &nemc {
251         nandc: nand-controller@1 {
252                 compatible = "ingenic,jz4740-nand";
253                 reg = <1 0 0x4000000>;
255                 #address-cells = <1>;
256                 #size-cells = <0>;
258                 ingenic,bch-controller = <&ecc>;
260                 pinctrl-names = "default";
261                 pinctrl-0 = <&pins_nemc>;
263                 rb-gpios = <&gpc 30 GPIO_ACTIVE_LOW>;
265                 nand@1 {
266                         reg = <1>;
268                         nand-ecc-step-size = <512>;
269                         nand-ecc-strength = <4>;
270                         nand-ecc-mode = "hw";
271                         nand-is-boot-medium;
272                         nand-on-flash-bbt;
274                         partitions {
275                                 compatible = "fixed-partitions";
276                                 #address-cells = <1>;
277                                 #size-cells = <1>;
279                                 partition@0 {
280                                         label = "boot";
281                                         reg = <0x0 0x400000>;
282                                 };
284                                 partition@400000 {
285                                         label = "kernel";
286                                         reg = <0x400000 0x400000>;
287                                 };
289                                 partition@800000 {
290                                         label = "rootfs";
291                                         reg = <0x800000 0x0>;
292                                 };
293                         };
294                 };
295         };
298 &lcd {
299         pinctrl-names = "default";
300         pinctrl-0 = <&pins_lcd>;
302         port {
303                 panel_output: endpoint {
304                         remote-endpoint = <&panel_input>;
305                 };
306         };
309 &udc {
310         phys = <&usb_phy>;
313 &pinctrl {
314         pins_lcd: lcd {
315                 function = "lcd";
316                 groups = "lcd-8bit";
317         };
319         pins_nemc: nemc {
320                 function = "nand";
321                 groups = "nand-cs1";
322         };
324         pins_uart0: uart0 {
325                 function = "uart0";
326                 groups = "uart0-data";
327                 bias-disable;
328         };
330         pins_mmc: mmc {
331                 mmc {
332                         function = "mmc";
333                         groups = "mmc-1bit", "mmc-4bit";
334                         bias-disable;
335                 };
337                 mmc-gpios {
338                         pins = "PD0", "PD2";
339                         bias-disable;
340                 };
341         };
344 &mmc {
345         bus-width = <4>;
346         max-frequency = <24000000>;
347         cd-gpios = <&gpd 0 GPIO_ACTIVE_HIGH>;
348         vmmc-supply = <&mmc_power>;
350         pinctrl-names = "default";
351         pinctrl-0 = <&pins_mmc>;
354 &tcu {
355         /* 750 kHz for the system timer and clocksource */
356         assigned-clocks = <&tcu TCU_CLK_TIMER0>, <&tcu TCU_CLK_TIMER1>;
357         assigned-clock-rates = <750000>, <750000>;