Linux Audio

Check our new training course

Embedded Linux Audio

Check our new training course
with Creative Commons CC-BY-SA
lecture materials

Bootlin logo

Elixir Cross Referencer

Loading...
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
// SPDX-License-Identifier: (GPL-2.0 OR MIT)
/*
 * Device Tree file for the Turris Omnia
 *
 * Copyright (C) 2016 Uwe Kleine-König <uwe@kleine-koenig.org>
 * Copyright (C) 2016 Tomas Hlavacek <tmshlvkc@gmail.com>
 *
 * Schematic available at https://www.turris.cz/doc/_media/rtrom01-schema.pdf
 */

/dts-v1/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>
#include "armada-385.dtsi"

/ {
	model = "Turris Omnia";
	compatible = "cznic,turris-omnia", "marvell,armada385", "marvell,armada380";

	chosen {
		stdout-path = &uart0;
	};

	aliases {
		ethernet0 = &eth0;
		ethernet1 = &eth1;
		ethernet2 = &eth2;
	};

	memory {
		device_type = "memory";
		reg = <0x00000000 0x40000000>; /* 1024 MB */
	};

	soc {
		ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000
			  MBUS_ID(0x01, 0x1d) 0 0xfff00000 0x100000
			  MBUS_ID(0x09, 0x19) 0 0xf1100000 0x10000
			  MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000
			  MBUS_ID(0x0c, 0x04) 0 0xf1200000 0x100000>;

		internal-regs {

			/* USB part of the PCIe2/USB 2.0 port */
			usb@58000 {
				status = "okay";
			};

			sata@a8000 {
				status = "okay";
			};

			sdhci@d8000 {
				pinctrl-names = "default";
				pinctrl-0 = <&sdhci_pins>;
				status = "okay";

				bus-width = <8>;
				no-1-8-v;
				non-removable;
			};

			usb3@f0000 {
				status = "okay";
			};

			usb3@f8000 {
				status = "okay";
			};
		};

		pcie {
			status = "okay";

			pcie@1,0 {
				/* Port 0, Lane 0 */
				status = "okay";
				slot-power-limit-milliwatt = <10000>;
			};

			pcie@2,0 {
				/* Port 1, Lane 0 */
				status = "okay";
				slot-power-limit-milliwatt = <10000>;
			};

			pcie@3,0 {
				/* Port 2, Lane 0 */
				status = "okay";
				slot-power-limit-milliwatt = <10000>;
			};
		};
	};

	sfp: sfp {
		compatible = "sff,sfp";
		i2c-bus = <&sfp_i2c>;
		tx-fault-gpios = <&pcawan 0 GPIO_ACTIVE_HIGH>;
		tx-disable-gpios = <&pcawan 1 GPIO_ACTIVE_HIGH>;
		rate-select0-gpios = <&pcawan 2 GPIO_ACTIVE_HIGH>;
		los-gpios = <&pcawan 3 GPIO_ACTIVE_HIGH>;
		mod-def0-gpios = <&pcawan 4 GPIO_ACTIVE_LOW>;
		maximum-power-milliwatt = <3000>;

		/*
		 * For now this has to be enabled at boot time by U-Boot when
		 * a SFP module is present. Read more in the comment in the
		 * eth2 node below.
		 */
		status = "disabled";
	};

	sound {
		compatible = "simple-audio-card";
		simple-audio-card,name = "SPDIF";
		simple-audio-card,format = "i2s";

		simple-audio-card,cpu {
			sound-dai = <&audio_controller 1>;
		};

		simple-audio-card,codec {
			sound-dai = <&spdif_out>;
		};
	};

	spdif_out: spdif-out {
		#sound-dai-cells = <0>;
		compatible = "linux,spdif-dit";
	};
};

&audio_controller {
	/* Pin header U16, GPIO51 in SPDIFO mode */
	pinctrl-0 = <&spdif_pins>;
	pinctrl-names = "default";
	spdif-mode;
	status = "okay";
};

&bm {
	status = "okay";
};

&bm_bppi {
	status = "okay";
};

/* Connected to 88E6176 switch, port 6 */
&eth0 {
	pinctrl-names = "default";
	pinctrl-0 = <&ge0_rgmii_pins>;
	status = "okay";
	phy-mode = "rgmii";
	buffer-manager = <&bm>;
	bm,pool-long = <0>;
	bm,pool-short = <3>;

	fixed-link {
		speed = <1000>;
		full-duplex;
	};
};

/* Connected to 88E6176 switch, port 5 */
&eth1 {
	pinctrl-names = "default";
	pinctrl-0 = <&ge1_rgmii_pins>;
	status = "okay";
	phy-mode = "rgmii";
	buffer-manager = <&bm>;
	bm,pool-long = <1>;
	bm,pool-short = <3>;

	fixed-link {
		speed = <1000>;
		full-duplex;
	};
};

/* WAN port */
&eth2 {
	/*
	 * eth2 is connected via a multiplexor to both the SFP cage and to
	 * ethernet-phy@1. The multiplexor switches the signal to SFP cage when
	 * a SFP module is present, as determined by the mode-def0 GPIO.
	 *
	 * Until kernel supports this configuration properly, in case SFP module
	 * is present, U-Boot has to enable the sfp node above, remove phy
	 * handle and add managed = "in-band-status" property.
	 */
	status = "okay";
	phy-mode = "sgmii";
	phy-handle = <&phy1>;
	phys = <&comphy5 2>;
	sfp = <&sfp>;
	buffer-manager = <&bm>;
	bm,pool-long = <2>;
	bm,pool-short = <3>;
	label = "wan";
};

&i2c0 {
	pinctrl-names = "default";
	pinctrl-0 = <&i2c0_pins>;
	status = "okay";

	i2cmux@70 {
		compatible = "nxp,pca9547";
		#address-cells = <1>;
		#size-cells = <0>;
		reg = <0x70>;

		i2c@0 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <0>;

			/* STM32F0 command interface at address 0x2a */

			led-controller@2b {
				compatible = "cznic,turris-omnia-leds";
				reg = <0x2b>;
				#address-cells = <1>;
				#size-cells = <0>;
				status = "okay";

				/*
				 * LEDs are controlled by MCU (STM32F0) at
				 * address 0x2b.
				 *
				 * LED functions are not stable yet:
				 * - there are 3 LEDs connected via MCU to PCIe
				 *   ports. One of these ports supports mSATA.
				 *   There is no mSATA nor PCIe function.
				 *   For now we use LED_FUNCTION_WLAN, since
				 *   in most cases users have wifi cards in
				 *   these slots
				 * - there are 2 LEDs dedicated for user: A and
				 *   B. Again there is no such function defined.
				 *   For now we use LED_FUNCTION_INDICATOR
				 */

				multi-led@0 {
					reg = <0x0>;
					color = <LED_COLOR_ID_RGB>;
					function = LED_FUNCTION_INDICATOR;
					function-enumerator = <2>;
				};

				multi-led@1 {
					reg = <0x1>;
					color = <LED_COLOR_ID_RGB>;
					function = LED_FUNCTION_INDICATOR;
					function-enumerator = <1>;
				};

				multi-led@2 {
					reg = <0x2>;
					color = <LED_COLOR_ID_RGB>;
					function = LED_FUNCTION_WLAN;
					function-enumerator = <3>;
				};

				multi-led@3 {
					reg = <0x3>;
					color = <LED_COLOR_ID_RGB>;
					function = LED_FUNCTION_WLAN;
					function-enumerator = <2>;
				};

				multi-led@4 {
					reg = <0x4>;
					color = <LED_COLOR_ID_RGB>;
					function = LED_FUNCTION_WLAN;
					function-enumerator = <1>;
				};

				multi-led@5 {
					reg = <0x5>;
					color = <LED_COLOR_ID_RGB>;
					function = LED_FUNCTION_WAN;
				};

				multi-led@6 {
					reg = <0x6>;
					color = <LED_COLOR_ID_RGB>;
					function = LED_FUNCTION_LAN;
					function-enumerator = <4>;
				};

				multi-led@7 {
					reg = <0x7>;
					color = <LED_COLOR_ID_RGB>;
					function = LED_FUNCTION_LAN;
					function-enumerator = <3>;
				};

				multi-led@8 {
					reg = <0x8>;
					color = <LED_COLOR_ID_RGB>;
					function = LED_FUNCTION_LAN;
					function-enumerator = <2>;
				};

				multi-led@9 {
					reg = <0x9>;
					color = <LED_COLOR_ID_RGB>;
					function = LED_FUNCTION_LAN;
					function-enumerator = <1>;
				};

				multi-led@a {
					reg = <0xa>;
					color = <LED_COLOR_ID_RGB>;
					function = LED_FUNCTION_LAN;
					function-enumerator = <0>;
				};

				multi-led@b {
					reg = <0xb>;
					color = <LED_COLOR_ID_RGB>;
					function = LED_FUNCTION_POWER;
				};
			};

			eeprom@54 {
				compatible = "atmel,24c64";
				reg = <0x54>;

				/* The EEPROM contains data for bootloader.
				 * Contents:
				 * 	struct omnia_eeprom {
				 * 		u32 magic; (=0x0341a034 in LE)
				 *		u32 ramsize; (in GiB)
				 * 		char regdomain[4];
				 * 		u32 crc32;
				 * 	};
				 */
			};
		};

		i2c@1 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <1>;

			/* routed to PCIe0/mSATA connector (CN7A) */
		};

		i2c@2 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <2>;

			/* routed to PCIe1/USB2 connector (CN61A) */
		};

		i2c@3 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <3>;

			/* routed to PCIe2 connector (CN62A) */
		};

		sfp_i2c: i2c@4 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <4>;

			/* routed to SFP+ */
		};

		i2c@5 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <5>;

			/* ATSHA204A-MAHDA-T crypto module */
			crypto@64 {
				compatible = "atmel,atsha204a";
				reg = <0x64>;
			};
		};

		i2c@6 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <6>;

			/* exposed on pin header */
		};

		i2c@7 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <7>;

			pcawan: gpio@71 {
				/*
				 * GPIO expander for SFP+ signals and
				 * and phy irq
				 */
				compatible = "nxp,pca9538";
				reg = <0x71>;

				pinctrl-names = "default";
				pinctrl-0 = <&pcawan_pins>;

				interrupt-parent = <&gpio1>;
				interrupts = <14 IRQ_TYPE_LEVEL_LOW>;

				gpio-controller;
				#gpio-cells = <2>;
			};
		};
	};
};

&mdio {
	pinctrl-names = "default";
	pinctrl-0 = <&mdio_pins>;
	status = "okay";

	phy1: ethernet-phy@1 {
		compatible = "ethernet-phy-ieee802.3-c22";
		reg = <1>;
		marvell,reg-init = <3 18 0 0x4985>,
				   <3 16 0xfff0 0x0001>;

		/* irq is connected to &pcawan pin 7 */
	};

	/* Switch MV88E6176 at address 0x10 */
	ethernet-switch@10 {
		pinctrl-names = "default";
		pinctrl-0 = <&swint_pins>;
		compatible = "marvell,mv88e6085";

		dsa,member = <0 0>;
		reg = <0x10>;

		interrupt-parent = <&gpio1>;
		interrupts = <13 IRQ_TYPE_LEVEL_LOW>;

		ethernet-ports {
			#address-cells = <1>;
			#size-cells = <0>;

			ethernet-port@0 {
				reg = <0>;
				label = "lan0";
			};

			ethernet-port@1 {
				reg = <1>;
				label = "lan1";
			};

			ethernet-port@2 {
				reg = <2>;
				label = "lan2";
			};

			ethernet-port@3 {
				reg = <3>;
				label = "lan3";
			};

			ethernet-port@4 {
				reg = <4>;
				label = "lan4";
			};

			ethernet-port@5 {
				reg = <5>;
				ethernet = <&eth1>;
				phy-mode = "rgmii-id";

				fixed-link {
					speed = <1000>;
					full-duplex;
				};
			};

			ethernet-port@6 {
				reg = <6>;
				ethernet = <&eth0>;
				phy-mode = "rgmii-id";

				fixed-link {
					speed = <1000>;
					full-duplex;
				};
			};
		};
	};
};

&pinctrl {
	pcawan_pins: pcawan-pins {
		marvell,pins = "mpp46";
		marvell,function = "gpio";
	};

	swint_pins: swint-pins {
		marvell,pins = "mpp45";
		marvell,function = "gpio";
	};

	spi0cs0_pins: spi0cs0-pins {
		marvell,pins = "mpp25";
		marvell,function = "spi0";
	};

	spi0cs2_pins: spi0cs2-pins {
		marvell,pins = "mpp26";
		marvell,function = "spi0";
	};
};

&spi0 {
	pinctrl-names = "default";
	pinctrl-0 = <&spi0_pins &spi0cs0_pins>;
	status = "okay";

	flash@0 {
		compatible = "spansion,s25fl164k", "jedec,spi-nor";
		#address-cells = <1>;
		#size-cells = <1>;
		reg = <0>;
		spi-max-frequency = <40000000>;

		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;

			partition@0 {
				reg = <0x0 0x00100000>;
				label = "U-Boot";
			};

			partition@100000 {
				reg = <0x00100000 0x00700000>;
				label = "Rescue system";
			};
		};
	};

	/* MISO, MOSI, SCLK and CS2 are routed to pin header CN11 */
};

&uart0 {
	/* Pin header CN10 */
	pinctrl-names = "default";
	pinctrl-0 = <&uart0_pins>;
	status = "okay";
};

&uart1 {
	/* Pin header CN11 */
	pinctrl-names = "default";
	pinctrl-0 = <&uart1_pins>;
	status = "okay";
};