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