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