1// SPDX-License-Identifier: GPL-2.0
2/dts-v1/;
3
4#include "jz4725b.dtsi"
5
6#include <dt-bindings/gpio/gpio.h>
7#include <dt-bindings/iio/adc/ingenic,adc.h>
8#include <dt-bindings/input/linux-event-codes.h>
9
10/ {
11	compatible = "ylm,rs90", "ingenic,jz4725b";
12	model = "RS-90";
13
14	memory {
15		device_type = "memory";
16		reg = <0x0 0x2000000>;
17	};
18
19	vcc: regulator {
20		compatible = "regulator-fixed";
21
22		regulator-name = "vcc";
23		regulaor-min-microvolt = <3300000>;
24		regulaor-max-microvolt = <3300000>;
25		regulator-always-on;
26	};
27
28	backlight: backlight {
29		compatible = "pwm-backlight";
30		pwms = <&pwm 3 40000 0>;
31
32		brightness-levels = <0 16 32 48 64 80 112 144 192 255>;
33		default-brightness-level = <8>;
34
35		pinctrl-names = "default";
36		pinctrl-0 = <&pins_pwm3>;
37
38		power-supply = <&vcc>;
39	};
40
41	keys@0 {
42		compatible = "gpio-keys";
43		#address-cells = <1>;
44		#size-cells = <0>;
45
46		key@0 {
47			label = "D-pad up";
48			linux,code = <KEY_UP>;
49			gpios = <&gpc 10 GPIO_ACTIVE_LOW>;
50		};
51
52		key@1 {
53			label = "D-pad down";
54			linux,code = <KEY_DOWN>;
55			gpios = <&gpc 11 GPIO_ACTIVE_LOW>;
56		};
57
58		key@2 {
59			label = "D-pad left";
60			linux,code = <KEY_LEFT>;
61			gpios = <&gpb 31 GPIO_ACTIVE_LOW>;
62		};
63
64		key@3 {
65			label = "D-pad right";
66			linux,code = <KEY_RIGHT>;
67			gpios = <&gpd 21 GPIO_ACTIVE_LOW>;
68		};
69
70		key@4 {
71			label = "Button A";
72			linux,code = <KEY_LEFTCTRL>;
73			gpios = <&gpc 31 GPIO_ACTIVE_LOW>;
74		};
75
76		key@5 {
77			label = "Button B";
78			linux,code = <KEY_LEFTALT>;
79			gpios = <&gpc 30 GPIO_ACTIVE_LOW>;
80		};
81
82		key@6 {
83			label = "Right shoulder button";
84			linux,code = <KEY_BACKSPACE>;
85			gpios = <&gpc 12 GPIO_ACTIVE_LOW>;
86			debounce-interval = <10>;
87		};
88
89		key@7 {
90			label = "Start button";
91			linux,code = <KEY_ENTER>;
92			gpios = <&gpd 17 GPIO_ACTIVE_LOW>;
93		};
94	};
95
96	keys@1 {
97		compatible = "adc-keys";
98		io-channels = <&adc INGENIC_ADC_AUX>;
99		io-channel-names = "buttons";
100		keyup-threshold-microvolt = <1400000>;
101		poll-interval = <30>;
102
103		key@0 {
104			label = "Left shoulder button";
105			linux,code = <KEY_TAB>;
106			press-threshold-microvolt = <800000>;
107		};
108
109		key@1 {
110			label = "Select button";
111			linux,code = <KEY_ESC>;
112			press-threshold-microvolt = <1100000>;
113		};
114	};
115
116	amp: analog-amplifier {
117		compatible = "simple-audio-amplifier";
118		enable-gpios = <&gpc 15 GPIO_ACTIVE_HIGH>;
119
120		VCC-supply = <&vcc>;
121	};
122
123	sound {
124		compatible = "simple-audio-card";
125
126		simple-audio-card,name = "rs90-audio";
127		simple-audio-card,format = "i2s";
128
129		simple-audio-card,widgets =
130			"Speaker", "Speaker",
131			"Headphone", "Headphones";
132		simple-audio-card,routing =
133			"INL", "LHPOUT",
134			"INR", "RHPOUT",
135			"Headphones", "LHPOUT",
136			"Headphones", "RHPOUT",
137			"Speaker", "OUTL",
138			"Speaker", "OUTR";
139		simple-audio-card,pin-switches = "Speaker";
140
141		simple-audio-card,hp-det-gpio = <&gpd 16 GPIO_ACTIVE_LOW>;
142		simple-audio-card,aux-devs = <&amp>;
143
144		simple-audio-card,bitclock-master = <&dai_codec>;
145		simple-audio-card,frame-master = <&dai_codec>;
146
147		dai_cpu: simple-audio-card,cpu {
148			sound-dai = <&aic>;
149		};
150
151		dai_codec: simple-audio-card,codec {
152			sound-dai = <&codec>;
153		};
154
155	};
156
157	usb_phy: usb-phy {
158		compatible = "usb-nop-xceiv";
159		#phy-cells = <0>;
160
161		clocks = <&cgu JZ4725B_CLK_UDC_PHY>;
162		clock-names = "main_clk";
163		vcc-supply = <&vcc>;
164	};
165
166	panel {
167		compatible = "sharp,ls020b1dd01d";
168
169		backlight = <&backlight>;
170		power-supply = <&vcc>;
171
172		port {
173			panel_input: endpoint {
174				remote-endpoint = <&panel_output>;
175			};
176		};
177	};
178};
179
180&ext {
181	clock-frequency = <12000000>;
182};
183
184&rtc_dev {
185	system-power-controller;
186};
187
188&udc {
189	phys = <&usb_phy>;
190};
191
192&pinctrl {
193	pins_mmc1: mmc1 {
194		function = "mmc1";
195		groups = "mmc1-1bit";
196	};
197
198	pins_nemc: nemc {
199		function = "nand";
200		groups = "nand-cs1", "nand-cle-ale", "nand-fre-fwe";
201	};
202
203	pins_pwm3: pwm3 {
204		function = "pwm3";
205		groups = "pwm3";
206		bias-disable;
207	};
208
209	pins_lcd: lcd {
210		function = "lcd";
211		groups = "lcd-8bit", "lcd-16bit", "lcd-special";
212	};
213};
214
215&mmc0 {
216	status = "disabled";
217};
218
219&mmc1 {
220	bus-width = <1>;
221	max-frequency = <48000000>;
222
223	pinctrl-names = "default";
224	pinctrl-0 = <&pins_mmc1>;
225
226	cd-gpios = <&gpc 20 GPIO_ACTIVE_LOW>;
227};
228
229&uart {
230	/*
231	 * The pins for RX/TX are used for the right shoulder button and
232	 * backlight PWM.
233	 */
234	status = "disabled";
235};
236
237&nemc {
238	nandc: nand-controller@1 {
239		compatible = "ingenic,jz4725b-nand";
240		reg = <1 0 0x4000000>;
241
242		#address-cells = <1>;
243		#size-cells = <0>;
244
245		ecc-engine = <&bch>;
246
247		ingenic,nemc-tAS = <10>;
248		ingenic,nemc-tAH = <5>;
249		ingenic,nemc-tBP = <10>;
250		ingenic,nemc-tAW = <15>;
251		ingenic,nemc-tSTRV = <100>;
252
253		pinctrl-names = "default";
254		pinctrl-0 = <&pins_nemc>;
255
256		rb-gpios = <&gpc 27 GPIO_ACTIVE_HIGH>;
257
258		nand@1 {
259			reg = <1>;
260
261			nand-ecc-step-size = <512>;
262			nand-ecc-strength = <8>;
263			nand-ecc-mode = "hw";
264			nand-is-boot-medium;
265			nand-on-flash-bbt;
266
267			partitions {
268				compatible = "fixed-partitions";
269				#address-cells = <1>;
270				#size-cells = <1>;
271
272				partition@0 {
273					label = "bootloader";
274					reg = <0x0 0x20000>;
275				};
276
277				partition@20000 {
278					label = "system";
279					reg = <0x20000 0x0>;
280				};
281			};
282		};
283	};
284};
285
286&cgu {
287	/* Use 32kHz oscillator as the parent of the RTC clock */
288	assigned-clocks = <&cgu JZ4725B_CLK_RTC>;
289	assigned-clock-parents = <&cgu JZ4725B_CLK_OSC32K>;
290};
291
292&tcu {
293	/*
294	 * 750 kHz for the system timer and clocksource, and use RTC as the
295	 * parent for the watchdog clock.
296	 */
297	assigned-clocks = <&tcu TCU_CLK_TIMER0>, <&tcu TCU_CLK_TIMER1>, <&tcu TCU_CLK_WDT>;
298	assigned-clock-parents = <0>, <0>, <&cgu JZ4725B_CLK_RTC>;
299	assigned-clock-rates = <750000>, <750000>;
300};
301
302&lcd {
303	pinctrl-names = "default";
304	pinctrl-0 = <&pins_lcd>;
305};
306
307&lcd_ports {
308	port@0 {
309		reg = <0>;
310
311		panel_output: endpoint {
312			remote-endpoint = <&panel_input>;
313		};
314	};
315};
316