1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Copyright 2011 ST-Ericsson AB
4 */
5
6/dts-v1/;
7#include "ste-db9500.dtsi"
8#include "ste-href-ab8500.dtsi"
9#include "ste-href-family-pinctrl.dtsi"
10
11/ {
12	model = "Calao Systems Snowball platform with device tree";
13	compatible = "calaosystems,snowball-a9500", "st-ericsson,u9500";
14
15	memory {
16		device_type = "memory";
17		reg = <0x00000000 0x20000000>;
18	};
19
20	battery: battery {
21		compatible = "simple-battery";
22		battery-type = "lithium-ion-polymer";
23		thermistor-on-batctrl;
24	};
25
26	en_3v3_reg: en_3v3 {
27		compatible = "regulator-fixed";
28		regulator-name = "en-3v3-fixed-supply";
29		regulator-min-microvolt = <3300000>;
30		regulator-max-microvolt = <3300000>;
31		/* AB8500 GPIOs start from 1 - offset 25 is GPIO26. */
32		gpio = <&ab8500_gpio 25 0x4>;
33		startup-delay-us = <5000>;
34		enable-active-high;
35	};
36
37	gpio_keys {
38		compatible = "gpio-keys";
39		#address-cells = <1>;
40		#size-cells = <0>;
41
42		button@1 {
43			debounce-interval = <50>;
44			wakeup-source;
45			linux,code = <2>;
46			label = "userpb";
47			gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>;
48		};
49		button@2 {
50			debounce-interval = <50>;
51			wakeup-source;
52			linux,code = <3>;
53			label = "extkb1";
54			gpios = <&gpio4 23 GPIO_ACTIVE_HIGH>;
55		};
56		button@3 {
57			debounce-interval = <50>;
58			wakeup-source;
59			linux,code = <4>;
60			label = "extkb2";
61			gpios = <&gpio4 24 GPIO_ACTIVE_HIGH>;
62		};
63		button@4 {
64			debounce-interval = <50>;
65			wakeup-source;
66			linux,code = <5>;
67			label = "extkb3";
68			gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>;
69		};
70		button@5 {
71			debounce-interval = <50>;
72			wakeup-source;
73			linux,code = <6>;
74			label = "extkb4";
75			gpios = <&gpio5 2 GPIO_ACTIVE_HIGH>;
76		};
77	};
78
79	leds {
80		compatible = "gpio-leds";
81		pinctrl-names = "default";
82		pinctrl-0 = <&gpioled_snowball_mode>;
83		used-led {
84			label = "user_led";
85			gpios = <&gpio4 14 GPIO_ACTIVE_HIGH>;
86			default-state = "on";
87			linux,default-trigger = "heartbeat";
88		};
89	};
90
91	soc {
92		/* Name the GPIO muxed rails on the Snowball board */
93		gpio@8012e000 {
94			/* GPIOs 0 - 31 */
95			gpio-line-names = "", "", "", "", "", "", "", "",
96				     "", "", "", "", "", "", "", "",
97				     "", "", "", "", "", "", "", "",
98				     "", "", "", "", "", "", "",
99				     "AP_GPIO31";
100		};
101
102		gpio@8012e080 {
103			/* GPIOs 32 - 63 */
104			gpio-line-names = "USR PB", "", "", "", "", "", "", "",
105				     "", "", "", "", "", "", "", "",
106				     "", "", "", "", "", "", "", "",
107				     "", "", "", "", "", "", "", "";
108		};
109
110		gpio@8000e000 {
111			/* GPIOs 64 - 95 */
112			gpio-line-names = "", "", "", "", "AP_GPIO68", "", "", "",
113				     "", "", "", "", "", "", "", "",
114				     "", "", "", "", "", "", "", "",
115				     "", "", "", "", "", "", "", "";
116		};
117
118		gpio@8000e100 {
119			/* GPIOs 128 - 159 */
120			gpio-line-names = "", "", "", "", "", "", "", "",
121				     "", "", "", "", "IRQ_LAN", "RSTn_LAN",
122				     "USR_LED", "", "", "", "", "", "",
123				     "", "", "AP_GPIO151", "AP_GPIO152",
124				     "", "", "", "", "", "", "";
125		};
126
127		gpio@8000e180 {
128			/* GPIOs 160 - 191 */
129			gpio-line-names = "", "AP_GPIO161", "AP_GPIO162",
130				     "ACCELEROMETER_INT1_RDY",
131				     "ACCELEROMETER_INT2", "MAG_DRDY",
132				     "GYRO_DRDY", "RSTn_MLC", "RSTn_SLC",
133				     "GYRO_INT", "UART_WAKE", "GBF_RESET",
134				     "", "", "", "",
135				     "", "", "", "", "", "", "", "",
136				     "", "", "", "", "", "", "", "";
137		};
138
139		gpio@8011e000 {
140			/* GPIOs 192 - 223 */
141			gpio-line-names = "HDTV_INTn", "", "", "", "HDTV_RST",
142				     "", "", "", "", "", "", "", "", "",
143				     "", "", "", "", "", "", "", "", "",
144				     "WLAN_RESETN", "WLAN_IRQ", "MMC_EN",
145				     "MMC_CD", "", "", "", "", "";
146		};
147
148		gpio@8011e080 {
149			/* GPIOs 224 - 255 */
150			gpio-line-names = "", "", "", "", "SD_SEL", "", "", "",
151				     "", "", "", "", "", "", "", "",
152				     "", "", "", "", "", "", "", "",
153				     "", "", "", "", "", "", "", "";
154		};
155
156		msp0: msp@80123000 {
157			pinctrl-names = "default";
158			pinctrl-0 = <&msp0txrxtfstck_a_1_default>;
159			status = "okay";
160		};
161
162		msp1: msp@80124000 {
163			pinctrl-names = "default";
164			pinctrl-0 = <&msp1txrx_a_1_default>;
165			status = "okay";
166		};
167
168		msp2: msp@80117000 {
169			pinctrl-names = "default";
170			pinctrl-0 = <&msp2_a_1_default>;
171		};
172
173		msp3: msp@80125000 {
174			status = "okay";
175		};
176
177		external-bus@50000000 {
178			status = "okay";
179
180			ethernet@0 {
181				compatible = "smsc,lan9115";
182				reg = <0 0x10000>;
183				interrupts = <12 IRQ_TYPE_EDGE_RISING>;
184				interrupt-parent = <&gpio4>;
185				vdd33a-supply = <&en_3v3_reg>;
186				vddvario-supply = <&db8500_vape_reg>;
187				pinctrl-names = "default";
188				pinctrl-0 = <&eth_snowball_mode>;
189
190				reg-shift = <1>;
191				reg-io-width = <2>;
192				smsc,force-internal-phy;
193				smsc,irq-active-high;
194				smsc,irq-push-pull;
195
196				clocks = <&prcc_pclk 3 0>;
197			};
198		};
199
200		/* ST6G3244ME level translator for 1.8/2.9 V */
201		vmmci: regulator-gpio {
202			compatible = "regulator-gpio";
203
204			/* GPIO228 SD_SEL */
205			gpios = <&gpio7 4 GPIO_ACTIVE_HIGH>;
206			/* GPIO217 MMC_EN */
207			enable-gpio = <&gpio6 25 GPIO_ACTIVE_HIGH>;
208			enable-active-high;
209
210			regulator-min-microvolt = <1800000>;
211			regulator-max-microvolt = <2900000>;
212			regulator-name = "mmci-reg";
213			regulator-type = "voltage";
214
215			startup-delay-us = <100>;
216
217			states = <1800000 0x1
218				  2900000 0x0>;
219		};
220
221		// External Micro SD slot
222		mmc@80126000 {
223			arm,primecell-periphid = <0x10480180>;
224			max-frequency = <100000000>;
225			bus-width = <4>;
226			cap-sd-highspeed;
227			cap-mmc-highspeed;
228			sd-uhs-sdr12;
229			sd-uhs-sdr25;
230			/* All direction control is used */
231			st,sig-dir-cmd;
232			st,sig-dir-dat0;
233			st,sig-dir-dat2;
234			st,sig-dir-dat31;
235			st,sig-pin-fbclk;
236			full-pwr-cycle;
237			vmmc-supply = <&ab8500_ldo_aux3_reg>;
238			vqmmc-supply = <&vmmci>;
239			pinctrl-names = "default", "sleep";
240			pinctrl-0 = <&mc0_a_1_default &sdi0_default_mode>;
241			pinctrl-1 = <&mc0_a_1_sleep>;
242
243			/* GPIO218 MMC_CD */
244			cd-gpios  = <&gpio6 26 GPIO_ACTIVE_LOW>;
245
246			status = "okay";
247		};
248
249		// WLAN SDIO channel
250		mmc@80118000 {
251			arm,primecell-periphid = <0x10480180>;
252			max-frequency = <100000000>;
253			bus-width = <4>;
254			pinctrl-names = "default", "sleep";
255			pinctrl-0 = <&mc1_a_1_default>;
256			pinctrl-1 = <&mc1_a_1_sleep>;
257
258			status = "okay";
259		};
260
261		// Unused PoP eMMC - register and put it to sleep by default */
262		mmc@80005000 {
263			arm,primecell-periphid = <0x10480180>;
264			pinctrl-names = "default";
265			pinctrl-0 = <&mc2_a_1_sleep>;
266
267			status = "okay";
268		};
269
270		// On-board eMMC
271		mmc@80114000 {
272			arm,primecell-periphid = <0x10480180>;
273		        max-frequency = <100000000>;
274			bus-width = <8>;
275			cap-mmc-highspeed;
276			no-sdio;
277			no-sd;
278			vmmc-supply = <&ab8500_ldo_aux2_reg>;
279			pinctrl-names = "default", "sleep";
280			pinctrl-0 = <&mc4_a_1_default>;
281			pinctrl-1 = <&mc4_a_1_sleep>;
282
283			status = "okay";
284		};
285
286		uart@80120000 {
287			pinctrl-names = "default", "sleep";
288			pinctrl-0 = <&u0_a_1_default>;
289			pinctrl-1 = <&u0_a_1_sleep>;
290			status = "okay";
291		};
292
293		/* This UART is unused and thus left disabled */
294		uart@80121000 {
295			pinctrl-names = "default", "sleep";
296			pinctrl-0 = <&u1rxtx_a_1_default>;
297			pinctrl-1 = <&u1rxtx_a_1_sleep>;
298		};
299
300		uart@80007000 {
301			pinctrl-names = "default", "sleep";
302			pinctrl-0 = <&u2rxtx_c_1_default>;
303			pinctrl-1 = <&u2rxtx_c_1_sleep>;
304			status = "okay";
305		};
306
307		i2c@80004000 {
308			pinctrl-names = "default","sleep";
309			pinctrl-0 = <&i2c0_a_1_default>;
310			pinctrl-1 = <&i2c0_a_1_sleep>;
311			status = "okay";
312		};
313
314		i2c@80122000 {
315			pinctrl-names = "default","sleep";
316			pinctrl-0 = <&i2c1_b_2_default>;
317			pinctrl-1 = <&i2c1_b_2_sleep>;
318			status = "okay";
319		};
320
321		i2c@80128000 {
322			pinctrl-names = "default","sleep";
323			pinctrl-0 = <&i2c2_b_2_default>;
324			pinctrl-1 = <&i2c2_b_2_sleep>;
325			status = "okay";
326			lsm303dlh@18 {
327				/* Accelerometer */
328				compatible = "st,lsm303dlh-accel";
329				st,drdy-int-pin = <1>;
330				reg = <0x18>;
331				vdd-supply = <&ab8500_ldo_aux1_reg>;
332				vddio-supply = <&db8500_vsmps2_reg>;
333				pinctrl-names = "default";
334				pinctrl-0 = <&accel_snowball_mode>;
335				interrupt-parent = <&gpio5>;
336				interrupts = <3 IRQ_TYPE_EDGE_RISING>, /* INT1 */
337					     <4 IRQ_TYPE_EDGE_RISING>; /* INT2 */
338			};
339			lsm303dlh@1e {
340				/* Magnetometer */
341				compatible = "st,lsm303dlh-magn";
342				reg = <0x1e>;
343				vdd-supply = <&ab8500_ldo_aux1_reg>;
344				vddio-supply = <&db8500_vsmps2_reg>;
345				pinctrl-names = "default";
346				pinctrl-0 = <&magneto_snowball_mode>;
347				interrupt-parent = <&gpio5>;
348				interrupts = <5 IRQ_TYPE_EDGE_RISING>; /* DRDY line */
349			};
350			l3g4200d@68 {
351				/* Gyroscope */
352				compatible = "st,l3g4200d-gyro";
353				st,drdy-int-pin = <2>;
354				reg = <0x68>;
355				vdd-supply = <&ab8500_ldo_aux1_reg>;
356				vddio-supply = <&db8500_vsmps2_reg>;
357				pinctrl-names = "default";
358				pinctrl-0 = <&gyro_snowball_mode>;
359				interrupt-parent = <&gpio5>;
360				interrupts = <6 IRQ_TYPE_EDGE_RISING>, /* DRDY line */
361					     <9 IRQ_TYPE_EDGE_RISING>; /* INT1 */
362			};
363			lsp001wm@5c {
364				/* Barometer/pressure sensor */
365				compatible = "st,lps001wp-press";
366				reg = <0x5c>;
367				vdd-supply = <&ab8500_ldo_aux1_reg>;
368				vddio-supply = <&db8500_vsmps2_reg>;
369			};
370		};
371
372		i2c@80110000 {
373			pinctrl-names = "default","sleep";
374			pinctrl-0 = <&i2c3_c_2_default>;
375			pinctrl-1 = <&i2c3_c_2_sleep>;
376			status = "okay";
377		};
378
379		spi@80002000 {
380			pinctrl-names = "default";
381			pinctrl-0 = <&ssp0_snowball_mode>;
382			status = "okay";
383		};
384
385		prcmu@80157000 {
386			ab8500 {
387				ab8500-gpiocontroller {
388					/*
389					 * AB8500 GPIOs are numbered starting from 1, so the first
390					 * index 0 is what in the datasheet is called "GPIO1", and
391					 * the second is "GPIO2" and so forth. Confusingly, the
392					 * Snowball schematic then names the "GPIO2" line "PM_GPIO1".
393					 * while later naming "GPIO4" as "PM_GPIO4".
394					 */
395					gpio-line-names = "", /* AB8500 GPIO1 */
396						     "PM_GPIO1", /* AB8500 GPIO2 */
397						     "WLAN_CLK_REQ", /* AB8500 GPIO3 */
398						     "PM_GPIO4", /* AB8500 GPIO4 */
399						     "", "", "", "", "", "", "", "", "", "", "",
400						     "EN_3V6", /* AB8500 GPIO16 */
401						     "", "", "", "" ,"", "", "", "", "",
402						     "EN_3V3", /* AB8500 GPIO26 */
403						     "", "", "", "", "", "", "", "", "", "", "", "", "",
404						     "PM_GPIO40", /* AB8500 GPIO40 */
405						     "PM_GPIO41", /* AB8500 GPIO41 */
406						     "PM_GPIO42"; /* AB8500 GPIO42 */
407				};
408
409				ab8500_usb {
410					pinctrl-names = "default", "sleep";
411					pinctrl-0 = <&usb_a_1_default>;
412					pinctrl-1 = <&usb_a_1_sleep>;
413				};
414
415				ext_regulators: ab8500-ext-regulators {
416					ab8500_ext1_reg: ab8500_ext1 {
417						regulator-name = "ab8500-ext-supply1";
418					};
419
420					ab8500_ext2_reg_reg: ab8500_ext2 {
421						regulator-name = "ab8500-ext-supply2";
422					};
423
424					ab8500_ext3_reg_reg: ab8500_ext3 {
425						regulator-name = "ab8500-ext-supply3";
426					};
427				};
428
429				ab8500-regulators {
430					ab8500_ldo_aux1_reg: ab8500_ldo_aux1 {
431						regulator-name = "V-DISPLAY";
432					};
433
434					ab8500_ldo_aux2_reg: ab8500_ldo_aux2 {
435						regulator-name = "V-eMMC1";
436					};
437
438					ab8500_ldo_aux3_reg: ab8500_ldo_aux3 {
439						regulator-name = "V-MMC-SD";
440					};
441
442					ab8500_ldo_intcore_reg: ab8500_ldo_intcore {
443						regulator-name = "V-INTCORE";
444					};
445
446					ab8500_ldo_tvout_reg: ab8500_ldo_tvout {
447						regulator-name = "V-TVOUT";
448					};
449
450					ab8500_ldo_audio_reg: ab8500_ldo_audio {
451						regulator-name = "V-AUD";
452					};
453
454					ab8500_ldo_anamic1_reg: ab8500_ldo_anamic1 {
455						regulator-name = "V-AMIC1";
456					};
457
458					ab8500_ldo_anamic2_reg: ab8500_ldo_anamic2 {
459						regulator-name = "V-AMIC2";
460					};
461
462					ab8500_ldo_dmic_reg: ab8500_ldo_dmic {
463						regulator-name = "V-DMIC";
464					};
465
466					ab8500_ldo_ana_reg: ab8500_ldo_ana {
467						regulator-name = "V-CSI/DSI";
468					};
469				};
470			};
471		};
472
473		pinctrl {
474			/*
475			 * Set this up using hogs, as time goes by and as seems fit, these
476			 * can be moved over to being controlled by respective device.
477			 */
478			pinctrl-names = "default";
479			pinctrl-0 = <&gbf_snowball_mode>,
480				  <&wlan_snowball_mode>;
481
482			ethernet {
483				/*
484				 * Mux in "SM" which is used for the
485				 * SMSC911x Ethernet adapter
486				 */
487				eth_snowball_mode: eth_snowball {
488					snowball_mux {
489						function = "sm";
490						groups = "sm_b_1";
491					};
492					/* LAN IRQ pin */
493					snowball_cfg1 {
494						pins = "GPIO140_B11";
495						ste,config = <&in_nopull>;
496					};
497					/* LAN reset pin */
498					snowball_cfg2 {
499						pins = "GPIO141_C12";
500						ste,config = <&gpio_out_hi>;
501					};
502
503				};
504			};
505			sdi0 {
506				sdi0_default_mode: sdi0_default {
507					snowball_mux {
508						function = "mc0";
509						/* Add the DAT31 pin even if it is not really used */
510						groups = "mc0dat31dir_a_1";
511					};
512					snowball_cfg1 {
513						pins = "GPIO21_AB3"; /* DAT31DIR */
514						ste,config = <&out_hi>;
515					};
516					/* SD card detect GPIO pin, extend default state */
517					snowball_cfg2 {
518						pins = "GPIO218_AH11";
519						ste,config = <&gpio_in_pu>;
520					};
521					/* VMMCI level-shifter enable */
522					snowball_cfg3 {
523						pins = "GPIO217_AH12";
524						ste,config = <&gpio_out_hi>;
525					};
526					/* VMMCI level-shifter voltage select */
527					snowball_cfg4 {
528						pins = "GPIO228_AJ6";
529						ste,config = <&gpio_out_hi>;
530					};
531				};
532			};
533			ssp0 {
534				ssp0_snowball_mode: ssp0_snowball_default {
535					snowball_mux {
536						function = "ssp0";
537						groups = "ssp0_a_1";
538					};
539					snowball_cfg1 {
540						pins = "GPIO144_B13"; /* FRM */
541						ste,config = <&gpio_out_hi>;
542					};
543					snowball_cfg2 {
544						pins = "GPIO145_C13"; /* RXD */
545						ste,config = <&in_pd>;
546					};
547					snowball_cfg3 {
548						pins =
549						"GPIO146_D13", /* TXD */
550						"GPIO143_D12"; /* CLK */
551						ste,config = <&out_lo>;
552					};
553
554				};
555			};
556			gpio_led {
557				gpioled_snowball_mode: gpioled_default {
558					snowball_cfg1 {
559						pins = "GPIO142_C11";
560						ste,config = <&gpio_out_hi>;
561					};
562
563				};
564			};
565			accelerometer {
566				accel_snowball_mode: accel_snowball {
567					/* Accelerometer lines */
568					snowball_cfg1 {
569						pins =
570						"GPIO163_C20", /* ACCEL_IRQ1 */
571						"GPIO164_B21"; /* ACCEL_IRQ2 */
572						ste,config = <&gpio_in_pu>;
573					};
574				};
575			};
576			gyro {
577				gyro_snowball_mode: gyro_snowball {
578					snowball_cfg1 {
579						pins =
580						"GPIO166_A22", /* DRDY */
581						"GPIO169_D22"; /* INT */
582						ste,config = <&gpio_in_pu>;
583					};
584				};
585			};
586			magnetometer {
587				magneto_snowball_mode: magneto_snowball {
588					snowball_cfg1 {
589						pins = "GPIO165_C21"; /* MAG_DRDY */
590						ste,config = <&gpio_in_pu>;
591					};
592				};
593			};
594			gbf {
595				gbf_snowball_mode: gbf_snowball {
596					/*
597					 * GBF (GPS, Bluetooth, FM-radio) interface,
598					 * pull low to reset state
599					 */
600					snowball_cfg1 {
601						pins = "GPIO171_D23"; /* GBF_ENA_RESET */
602						ste,config = <&gpio_out_lo>;
603					};
604				 };
605			};
606			wlan {
607				wlan_snowball_mode: wlan_snowball {
608					/*
609					 * Activate this mode with the WLAN chip.
610					 * These are plain GPIO pins used by WLAN
611					 */
612					snowball_cfg1 {
613						pins =
614						"GPIO161_D21", /* WLAN_PMU_EN */
615						"GPIO215_AH13"; /* WLAN_ENA */
616						ste,config = <&gpio_out_lo>;
617					};
618					snowball_cfg2 {
619						pins = "GPIO216_AG12"; /* WLAN_IRQ */
620						ste,config = <&gpio_in_pu>;
621					};
622				};
623			};
624		};
625
626		mcde@a0350000 {
627			pinctrl-names = "default", "sleep";
628			pinctrl-0 = <&lcd_default_mode>;
629			pinctrl-1 = <&lcd_sleep_mode>;
630		};
631	};
632};
633