Loading...
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (C) 2014 NVIDIA CORPORATION. All rights reserved.
4 */
5
6#include <linux/of.h>
7#include <linux/device.h>
8#include <linux/slab.h>
9
10#include <dt-bindings/memory/tegra124-mc.h>
11
12#include "mc.h"
13
14static const struct tegra_mc_client tegra124_mc_clients[] = {
15 {
16 .id = 0x00,
17 .name = "ptcr",
18 .swgroup = TEGRA_SWGROUP_PTC,
19 .regs = {
20 .la = {
21 .reg = 0x34c,
22 .shift = 0,
23 .mask = 0xff,
24 .def = 0x0,
25 },
26 },
27 }, {
28 .id = 0x01,
29 .name = "display0a",
30 .swgroup = TEGRA_SWGROUP_DC,
31 .regs = {
32 .smmu = {
33 .reg = 0x228,
34 .bit = 1,
35 },
36 .la = {
37 .reg = 0x2e8,
38 .shift = 0,
39 .mask = 0xff,
40 .def = 0xc2,
41 },
42 },
43 }, {
44 .id = 0x02,
45 .name = "display0ab",
46 .swgroup = TEGRA_SWGROUP_DCB,
47 .regs = {
48 .smmu = {
49 .reg = 0x228,
50 .bit = 2,
51 },
52 .la = {
53 .reg = 0x2f4,
54 .shift = 0,
55 .mask = 0xff,
56 .def = 0xc6,
57 },
58 },
59 }, {
60 .id = 0x03,
61 .name = "display0b",
62 .swgroup = TEGRA_SWGROUP_DC,
63 .regs = {
64 .smmu = {
65 .reg = 0x228,
66 .bit = 3,
67 },
68 .la = {
69 .reg = 0x2e8,
70 .shift = 16,
71 .mask = 0xff,
72 .def = 0x50,
73 },
74 },
75 }, {
76 .id = 0x04,
77 .name = "display0bb",
78 .swgroup = TEGRA_SWGROUP_DCB,
79 .regs = {
80 .smmu = {
81 .reg = 0x228,
82 .bit = 4,
83 },
84 .la = {
85 .reg = 0x2f4,
86 .shift = 16,
87 .mask = 0xff,
88 .def = 0x50,
89 },
90 },
91 }, {
92 .id = 0x05,
93 .name = "display0c",
94 .swgroup = TEGRA_SWGROUP_DC,
95 .regs = {
96 .smmu = {
97 .reg = 0x228,
98 .bit = 5,
99 },
100 .la = {
101 .reg = 0x2ec,
102 .shift = 0,
103 .mask = 0xff,
104 .def = 0x50,
105 },
106 },
107 }, {
108 .id = 0x06,
109 .name = "display0cb",
110 .swgroup = TEGRA_SWGROUP_DCB,
111 .regs = {
112 .smmu = {
113 .reg = 0x228,
114 .bit = 6,
115 },
116 .la = {
117 .reg = 0x2f8,
118 .shift = 0,
119 .mask = 0xff,
120 .def = 0x50,
121 },
122 },
123 }, {
124 .id = 0x0e,
125 .name = "afir",
126 .swgroup = TEGRA_SWGROUP_AFI,
127 .regs = {
128 .smmu = {
129 .reg = 0x228,
130 .bit = 14,
131 },
132 .la = {
133 .reg = 0x2e0,
134 .shift = 0,
135 .mask = 0xff,
136 .def = 0x13,
137 },
138 },
139 }, {
140 .id = 0x0f,
141 .name = "avpcarm7r",
142 .swgroup = TEGRA_SWGROUP_AVPC,
143 .regs = {
144 .smmu = {
145 .reg = 0x228,
146 .bit = 15,
147 },
148 .la = {
149 .reg = 0x2e4,
150 .shift = 0,
151 .mask = 0xff,
152 .def = 0x04,
153 },
154 },
155 }, {
156 .id = 0x10,
157 .name = "displayhc",
158 .swgroup = TEGRA_SWGROUP_DC,
159 .regs = {
160 .smmu = {
161 .reg = 0x228,
162 .bit = 16,
163 },
164 .la = {
165 .reg = 0x2f0,
166 .shift = 0,
167 .mask = 0xff,
168 .def = 0x50,
169 },
170 },
171 }, {
172 .id = 0x11,
173 .name = "displayhcb",
174 .swgroup = TEGRA_SWGROUP_DCB,
175 .regs = {
176 .smmu = {
177 .reg = 0x228,
178 .bit = 17,
179 },
180 .la = {
181 .reg = 0x2fc,
182 .shift = 0,
183 .mask = 0xff,
184 .def = 0x50,
185 },
186 },
187 }, {
188 .id = 0x15,
189 .name = "hdar",
190 .swgroup = TEGRA_SWGROUP_HDA,
191 .regs = {
192 .smmu = {
193 .reg = 0x228,
194 .bit = 21,
195 },
196 .la = {
197 .reg = 0x318,
198 .shift = 0,
199 .mask = 0xff,
200 .def = 0x24,
201 },
202 },
203 }, {
204 .id = 0x16,
205 .name = "host1xdmar",
206 .swgroup = TEGRA_SWGROUP_HC,
207 .regs = {
208 .smmu = {
209 .reg = 0x228,
210 .bit = 22,
211 },
212 .la = {
213 .reg = 0x310,
214 .shift = 0,
215 .mask = 0xff,
216 .def = 0x1e,
217 },
218 },
219 }, {
220 .id = 0x17,
221 .name = "host1xr",
222 .swgroup = TEGRA_SWGROUP_HC,
223 .regs = {
224 .smmu = {
225 .reg = 0x228,
226 .bit = 23,
227 },
228 .la = {
229 .reg = 0x310,
230 .shift = 16,
231 .mask = 0xff,
232 .def = 0x50,
233 },
234 },
235 }, {
236 .id = 0x1c,
237 .name = "msencsrd",
238 .swgroup = TEGRA_SWGROUP_MSENC,
239 .regs = {
240 .smmu = {
241 .reg = 0x228,
242 .bit = 28,
243 },
244 .la = {
245 .reg = 0x328,
246 .shift = 0,
247 .mask = 0xff,
248 .def = 0x23,
249 },
250 },
251 }, {
252 .id = 0x1d,
253 .name = "ppcsahbdmar",
254 .swgroup = TEGRA_SWGROUP_PPCS,
255 .regs = {
256 .smmu = {
257 .reg = 0x228,
258 .bit = 29,
259 },
260 .la = {
261 .reg = 0x344,
262 .shift = 0,
263 .mask = 0xff,
264 .def = 0x49,
265 },
266 },
267 }, {
268 .id = 0x1e,
269 .name = "ppcsahbslvr",
270 .swgroup = TEGRA_SWGROUP_PPCS,
271 .regs = {
272 .smmu = {
273 .reg = 0x228,
274 .bit = 30,
275 },
276 .la = {
277 .reg = 0x344,
278 .shift = 16,
279 .mask = 0xff,
280 .def = 0x1a,
281 },
282 },
283 }, {
284 .id = 0x1f,
285 .name = "satar",
286 .swgroup = TEGRA_SWGROUP_SATA,
287 .regs = {
288 .smmu = {
289 .reg = 0x228,
290 .bit = 31,
291 },
292 .la = {
293 .reg = 0x350,
294 .shift = 0,
295 .mask = 0xff,
296 .def = 0x65,
297 },
298 },
299 }, {
300 .id = 0x22,
301 .name = "vdebsevr",
302 .swgroup = TEGRA_SWGROUP_VDE,
303 .regs = {
304 .smmu = {
305 .reg = 0x22c,
306 .bit = 2,
307 },
308 .la = {
309 .reg = 0x354,
310 .shift = 0,
311 .mask = 0xff,
312 .def = 0x4f,
313 },
314 },
315 }, {
316 .id = 0x23,
317 .name = "vdember",
318 .swgroup = TEGRA_SWGROUP_VDE,
319 .regs = {
320 .smmu = {
321 .reg = 0x22c,
322 .bit = 3,
323 },
324 .la = {
325 .reg = 0x354,
326 .shift = 16,
327 .mask = 0xff,
328 .def = 0x3d,
329 },
330 },
331 }, {
332 .id = 0x24,
333 .name = "vdemcer",
334 .swgroup = TEGRA_SWGROUP_VDE,
335 .regs = {
336 .smmu = {
337 .reg = 0x22c,
338 .bit = 4,
339 },
340 .la = {
341 .reg = 0x358,
342 .shift = 0,
343 .mask = 0xff,
344 .def = 0x66,
345 },
346 },
347 }, {
348 .id = 0x25,
349 .name = "vdetper",
350 .swgroup = TEGRA_SWGROUP_VDE,
351 .regs = {
352 .smmu = {
353 .reg = 0x22c,
354 .bit = 5,
355 },
356 .la = {
357 .reg = 0x358,
358 .shift = 16,
359 .mask = 0xff,
360 .def = 0xa5,
361 },
362 },
363 }, {
364 .id = 0x26,
365 .name = "mpcorelpr",
366 .swgroup = TEGRA_SWGROUP_MPCORELP,
367 .regs = {
368 .la = {
369 .reg = 0x324,
370 .shift = 0,
371 .mask = 0xff,
372 .def = 0x04,
373 },
374 },
375 }, {
376 .id = 0x27,
377 .name = "mpcorer",
378 .swgroup = TEGRA_SWGROUP_MPCORE,
379 .regs = {
380 .la = {
381 .reg = 0x320,
382 .shift = 0,
383 .mask = 0xff,
384 .def = 0x04,
385 },
386 },
387 }, {
388 .id = 0x2b,
389 .name = "msencswr",
390 .swgroup = TEGRA_SWGROUP_MSENC,
391 .regs = {
392 .smmu = {
393 .reg = 0x22c,
394 .bit = 11,
395 },
396 .la = {
397 .reg = 0x328,
398 .shift = 16,
399 .mask = 0xff,
400 .def = 0x80,
401 },
402 },
403 }, {
404 .id = 0x31,
405 .name = "afiw",
406 .swgroup = TEGRA_SWGROUP_AFI,
407 .regs = {
408 .smmu = {
409 .reg = 0x22c,
410 .bit = 17,
411 },
412 .la = {
413 .reg = 0x2e0,
414 .shift = 16,
415 .mask = 0xff,
416 .def = 0x80,
417 },
418 },
419 }, {
420 .id = 0x32,
421 .name = "avpcarm7w",
422 .swgroup = TEGRA_SWGROUP_AVPC,
423 .regs = {
424 .smmu = {
425 .reg = 0x22c,
426 .bit = 18,
427 },
428 .la = {
429 .reg = 0x2e4,
430 .shift = 16,
431 .mask = 0xff,
432 .def = 0x80,
433 },
434 },
435 }, {
436 .id = 0x35,
437 .name = "hdaw",
438 .swgroup = TEGRA_SWGROUP_HDA,
439 .regs = {
440 .smmu = {
441 .reg = 0x22c,
442 .bit = 21,
443 },
444 .la = {
445 .reg = 0x318,
446 .shift = 16,
447 .mask = 0xff,
448 .def = 0x80,
449 },
450 },
451 }, {
452 .id = 0x36,
453 .name = "host1xw",
454 .swgroup = TEGRA_SWGROUP_HC,
455 .regs = {
456 .smmu = {
457 .reg = 0x22c,
458 .bit = 22,
459 },
460 .la = {
461 .reg = 0x314,
462 .shift = 0,
463 .mask = 0xff,
464 .def = 0x80,
465 },
466 },
467 }, {
468 .id = 0x38,
469 .name = "mpcorelpw",
470 .swgroup = TEGRA_SWGROUP_MPCORELP,
471 .regs = {
472 .la = {
473 .reg = 0x324,
474 .shift = 16,
475 .mask = 0xff,
476 .def = 0x80,
477 },
478 },
479 }, {
480 .id = 0x39,
481 .name = "mpcorew",
482 .swgroup = TEGRA_SWGROUP_MPCORE,
483 .regs = {
484 .la = {
485 .reg = 0x320,
486 .shift = 16,
487 .mask = 0xff,
488 .def = 0x80,
489 },
490 },
491 }, {
492 .id = 0x3b,
493 .name = "ppcsahbdmaw",
494 .swgroup = TEGRA_SWGROUP_PPCS,
495 .regs = {
496 .smmu = {
497 .reg = 0x22c,
498 .bit = 27,
499 },
500 .la = {
501 .reg = 0x348,
502 .shift = 0,
503 .mask = 0xff,
504 .def = 0x80,
505 },
506 },
507 }, {
508 .id = 0x3c,
509 .name = "ppcsahbslvw",
510 .swgroup = TEGRA_SWGROUP_PPCS,
511 .regs = {
512 .smmu = {
513 .reg = 0x22c,
514 .bit = 28,
515 },
516 .la = {
517 .reg = 0x348,
518 .shift = 16,
519 .mask = 0xff,
520 .def = 0x80,
521 },
522 },
523 }, {
524 .id = 0x3d,
525 .name = "sataw",
526 .swgroup = TEGRA_SWGROUP_SATA,
527 .regs = {
528 .smmu = {
529 .reg = 0x22c,
530 .bit = 29,
531 },
532 .la = {
533 .reg = 0x350,
534 .shift = 16,
535 .mask = 0xff,
536 .def = 0x65,
537 },
538 },
539 }, {
540 .id = 0x3e,
541 .name = "vdebsevw",
542 .swgroup = TEGRA_SWGROUP_VDE,
543 .regs = {
544 .smmu = {
545 .reg = 0x22c,
546 .bit = 30,
547 },
548 .la = {
549 .reg = 0x35c,
550 .shift = 0,
551 .mask = 0xff,
552 .def = 0x80,
553 },
554 },
555 }, {
556 .id = 0x3f,
557 .name = "vdedbgw",
558 .swgroup = TEGRA_SWGROUP_VDE,
559 .regs = {
560 .smmu = {
561 .reg = 0x22c,
562 .bit = 31,
563 },
564 .la = {
565 .reg = 0x35c,
566 .shift = 16,
567 .mask = 0xff,
568 .def = 0x80,
569 },
570 },
571 }, {
572 .id = 0x40,
573 .name = "vdembew",
574 .swgroup = TEGRA_SWGROUP_VDE,
575 .regs = {
576 .smmu = {
577 .reg = 0x230,
578 .bit = 0,
579 },
580 .la = {
581 .reg = 0x360,
582 .shift = 0,
583 .mask = 0xff,
584 .def = 0x80,
585 },
586 },
587 }, {
588 .id = 0x41,
589 .name = "vdetpmw",
590 .swgroup = TEGRA_SWGROUP_VDE,
591 .regs = {
592 .smmu = {
593 .reg = 0x230,
594 .bit = 1,
595 },
596 .la = {
597 .reg = 0x360,
598 .shift = 16,
599 .mask = 0xff,
600 .def = 0x80,
601 },
602 },
603 }, {
604 .id = 0x44,
605 .name = "ispra",
606 .swgroup = TEGRA_SWGROUP_ISP2,
607 .regs = {
608 .smmu = {
609 .reg = 0x230,
610 .bit = 4,
611 },
612 .la = {
613 .reg = 0x370,
614 .shift = 0,
615 .mask = 0xff,
616 .def = 0x18,
617 },
618 },
619 }, {
620 .id = 0x46,
621 .name = "ispwa",
622 .swgroup = TEGRA_SWGROUP_ISP2,
623 .regs = {
624 .smmu = {
625 .reg = 0x230,
626 .bit = 6,
627 },
628 .la = {
629 .reg = 0x374,
630 .shift = 0,
631 .mask = 0xff,
632 .def = 0x80,
633 },
634 },
635 }, {
636 .id = 0x47,
637 .name = "ispwb",
638 .swgroup = TEGRA_SWGROUP_ISP2,
639 .regs = {
640 .smmu = {
641 .reg = 0x230,
642 .bit = 7,
643 },
644 .la = {
645 .reg = 0x374,
646 .shift = 16,
647 .mask = 0xff,
648 .def = 0x80,
649 },
650 },
651 }, {
652 .id = 0x4a,
653 .name = "xusb_hostr",
654 .swgroup = TEGRA_SWGROUP_XUSB_HOST,
655 .regs = {
656 .smmu = {
657 .reg = 0x230,
658 .bit = 10,
659 },
660 .la = {
661 .reg = 0x37c,
662 .shift = 0,
663 .mask = 0xff,
664 .def = 0x39,
665 },
666 },
667 }, {
668 .id = 0x4b,
669 .name = "xusb_hostw",
670 .swgroup = TEGRA_SWGROUP_XUSB_HOST,
671 .regs = {
672 .smmu = {
673 .reg = 0x230,
674 .bit = 11,
675 },
676 .la = {
677 .reg = 0x37c,
678 .shift = 16,
679 .mask = 0xff,
680 .def = 0x80,
681 },
682 },
683 }, {
684 .id = 0x4c,
685 .name = "xusb_devr",
686 .swgroup = TEGRA_SWGROUP_XUSB_DEV,
687 .regs = {
688 .smmu = {
689 .reg = 0x230,
690 .bit = 12,
691 },
692 .la = {
693 .reg = 0x380,
694 .shift = 0,
695 .mask = 0xff,
696 .def = 0x39,
697 },
698 },
699 }, {
700 .id = 0x4d,
701 .name = "xusb_devw",
702 .swgroup = TEGRA_SWGROUP_XUSB_DEV,
703 .regs = {
704 .smmu = {
705 .reg = 0x230,
706 .bit = 13,
707 },
708 .la = {
709 .reg = 0x380,
710 .shift = 16,
711 .mask = 0xff,
712 .def = 0x80,
713 },
714 },
715 }, {
716 .id = 0x4e,
717 .name = "isprab",
718 .swgroup = TEGRA_SWGROUP_ISP2B,
719 .regs = {
720 .smmu = {
721 .reg = 0x230,
722 .bit = 14,
723 },
724 .la = {
725 .reg = 0x384,
726 .shift = 0,
727 .mask = 0xff,
728 .def = 0x18,
729 },
730 },
731 }, {
732 .id = 0x50,
733 .name = "ispwab",
734 .swgroup = TEGRA_SWGROUP_ISP2B,
735 .regs = {
736 .smmu = {
737 .reg = 0x230,
738 .bit = 16,
739 },
740 .la = {
741 .reg = 0x388,
742 .shift = 0,
743 .mask = 0xff,
744 .def = 0x80,
745 },
746 },
747 }, {
748 .id = 0x51,
749 .name = "ispwbb",
750 .swgroup = TEGRA_SWGROUP_ISP2B,
751 .regs = {
752 .smmu = {
753 .reg = 0x230,
754 .bit = 17,
755 },
756 .la = {
757 .reg = 0x388,
758 .shift = 16,
759 .mask = 0xff,
760 .def = 0x80,
761 },
762 },
763 }, {
764 .id = 0x54,
765 .name = "tsecsrd",
766 .swgroup = TEGRA_SWGROUP_TSEC,
767 .regs = {
768 .smmu = {
769 .reg = 0x230,
770 .bit = 20,
771 },
772 .la = {
773 .reg = 0x390,
774 .shift = 0,
775 .mask = 0xff,
776 .def = 0x9b,
777 },
778 },
779 }, {
780 .id = 0x55,
781 .name = "tsecswr",
782 .swgroup = TEGRA_SWGROUP_TSEC,
783 .regs = {
784 .smmu = {
785 .reg = 0x230,
786 .bit = 21,
787 },
788 .la = {
789 .reg = 0x390,
790 .shift = 16,
791 .mask = 0xff,
792 .def = 0x80,
793 },
794 },
795 }, {
796 .id = 0x56,
797 .name = "a9avpscr",
798 .swgroup = TEGRA_SWGROUP_A9AVP,
799 .regs = {
800 .smmu = {
801 .reg = 0x230,
802 .bit = 22,
803 },
804 .la = {
805 .reg = 0x3a4,
806 .shift = 0,
807 .mask = 0xff,
808 .def = 0x04,
809 },
810 },
811 }, {
812 .id = 0x57,
813 .name = "a9avpscw",
814 .swgroup = TEGRA_SWGROUP_A9AVP,
815 .regs = {
816 .smmu = {
817 .reg = 0x230,
818 .bit = 23,
819 },
820 .la = {
821 .reg = 0x3a4,
822 .shift = 16,
823 .mask = 0xff,
824 .def = 0x80,
825 },
826 },
827 }, {
828 .id = 0x58,
829 .name = "gpusrd",
830 .swgroup = TEGRA_SWGROUP_GPU,
831 .regs = {
832 .smmu = {
833 /* read-only */
834 .reg = 0x230,
835 .bit = 24,
836 },
837 .la = {
838 .reg = 0x3c8,
839 .shift = 0,
840 .mask = 0xff,
841 .def = 0x1a,
842 },
843 },
844 }, {
845 .id = 0x59,
846 .name = "gpuswr",
847 .swgroup = TEGRA_SWGROUP_GPU,
848 .regs = {
849 .smmu = {
850 /* read-only */
851 .reg = 0x230,
852 .bit = 25,
853 },
854 .la = {
855 .reg = 0x3c8,
856 .shift = 16,
857 .mask = 0xff,
858 .def = 0x80,
859 },
860 },
861 }, {
862 .id = 0x5a,
863 .name = "displayt",
864 .swgroup = TEGRA_SWGROUP_DC,
865 .regs = {
866 .smmu = {
867 .reg = 0x230,
868 .bit = 26,
869 },
870 .la = {
871 .reg = 0x2f0,
872 .shift = 16,
873 .mask = 0xff,
874 .def = 0x50,
875 },
876 },
877 }, {
878 .id = 0x60,
879 .name = "sdmmcra",
880 .swgroup = TEGRA_SWGROUP_SDMMC1A,
881 .regs = {
882 .smmu = {
883 .reg = 0x234,
884 .bit = 0,
885 },
886 .la = {
887 .reg = 0x3b8,
888 .shift = 0,
889 .mask = 0xff,
890 .def = 0x49,
891 },
892 },
893 }, {
894 .id = 0x61,
895 .name = "sdmmcraa",
896 .swgroup = TEGRA_SWGROUP_SDMMC2A,
897 .regs = {
898 .smmu = {
899 .reg = 0x234,
900 .bit = 1,
901 },
902 .la = {
903 .reg = 0x3bc,
904 .shift = 0,
905 .mask = 0xff,
906 .def = 0x49,
907 },
908 },
909 }, {
910 .id = 0x62,
911 .name = "sdmmcr",
912 .swgroup = TEGRA_SWGROUP_SDMMC3A,
913 .regs = {
914 .smmu = {
915 .reg = 0x234,
916 .bit = 2,
917 },
918 .la = {
919 .reg = 0x3c0,
920 .shift = 0,
921 .mask = 0xff,
922 .def = 0x49,
923 },
924 },
925 }, {
926 .id = 0x63,
927 .swgroup = TEGRA_SWGROUP_SDMMC4A,
928 .name = "sdmmcrab",
929 .regs = {
930 .smmu = {
931 .reg = 0x234,
932 .bit = 3,
933 },
934 .la = {
935 .reg = 0x3c4,
936 .shift = 0,
937 .mask = 0xff,
938 .def = 0x49,
939 },
940 },
941 }, {
942 .id = 0x64,
943 .name = "sdmmcwa",
944 .swgroup = TEGRA_SWGROUP_SDMMC1A,
945 .regs = {
946 .smmu = {
947 .reg = 0x234,
948 .bit = 4,
949 },
950 .la = {
951 .reg = 0x3b8,
952 .shift = 16,
953 .mask = 0xff,
954 .def = 0x80,
955 },
956 },
957 }, {
958 .id = 0x65,
959 .name = "sdmmcwaa",
960 .swgroup = TEGRA_SWGROUP_SDMMC2A,
961 .regs = {
962 .smmu = {
963 .reg = 0x234,
964 .bit = 5,
965 },
966 .la = {
967 .reg = 0x3bc,
968 .shift = 16,
969 .mask = 0xff,
970 .def = 0x80,
971 },
972 },
973 }, {
974 .id = 0x66,
975 .name = "sdmmcw",
976 .swgroup = TEGRA_SWGROUP_SDMMC3A,
977 .regs = {
978 .smmu = {
979 .reg = 0x234,
980 .bit = 6,
981 },
982 .la = {
983 .reg = 0x3c0,
984 .shift = 16,
985 .mask = 0xff,
986 .def = 0x80,
987 },
988 },
989 }, {
990 .id = 0x67,
991 .name = "sdmmcwab",
992 .swgroup = TEGRA_SWGROUP_SDMMC4A,
993 .regs = {
994 .smmu = {
995 .reg = 0x234,
996 .bit = 7,
997 },
998 .la = {
999 .reg = 0x3c4,
1000 .shift = 16,
1001 .mask = 0xff,
1002 .def = 0x80,
1003 },
1004 },
1005 }, {
1006 .id = 0x6c,
1007 .name = "vicsrd",
1008 .swgroup = TEGRA_SWGROUP_VIC,
1009 .regs = {
1010 .smmu = {
1011 .reg = 0x234,
1012 .bit = 12,
1013 },
1014 .la = {
1015 .reg = 0x394,
1016 .shift = 0,
1017 .mask = 0xff,
1018 .def = 0x1a,
1019 },
1020 },
1021 }, {
1022 .id = 0x6d,
1023 .name = "vicswr",
1024 .swgroup = TEGRA_SWGROUP_VIC,
1025 .regs = {
1026 .smmu = {
1027 .reg = 0x234,
1028 .bit = 13,
1029 },
1030 .la = {
1031 .reg = 0x394,
1032 .shift = 16,
1033 .mask = 0xff,
1034 .def = 0x80,
1035 },
1036 },
1037 }, {
1038 .id = 0x72,
1039 .name = "viw",
1040 .swgroup = TEGRA_SWGROUP_VI,
1041 .regs = {
1042 .smmu = {
1043 .reg = 0x234,
1044 .bit = 18,
1045 },
1046 .la = {
1047 .reg = 0x398,
1048 .shift = 0,
1049 .mask = 0xff,
1050 .def = 0x80,
1051 },
1052 },
1053 }, {
1054 .id = 0x73,
1055 .name = "displayd",
1056 .swgroup = TEGRA_SWGROUP_DC,
1057 .regs = {
1058 .smmu = {
1059 .reg = 0x234,
1060 .bit = 19,
1061 },
1062 .la = {
1063 .reg = 0x3c8,
1064 .shift = 0,
1065 .mask = 0xff,
1066 .def = 0x50,
1067 },
1068 },
1069 },
1070};
1071
1072static const struct tegra_smmu_swgroup tegra124_swgroups[] = {
1073 { .name = "dc", .swgroup = TEGRA_SWGROUP_DC, .reg = 0x240 },
1074 { .name = "dcb", .swgroup = TEGRA_SWGROUP_DCB, .reg = 0x244 },
1075 { .name = "afi", .swgroup = TEGRA_SWGROUP_AFI, .reg = 0x238 },
1076 { .name = "avpc", .swgroup = TEGRA_SWGROUP_AVPC, .reg = 0x23c },
1077 { .name = "hda", .swgroup = TEGRA_SWGROUP_HDA, .reg = 0x254 },
1078 { .name = "hc", .swgroup = TEGRA_SWGROUP_HC, .reg = 0x250 },
1079 { .name = "msenc", .swgroup = TEGRA_SWGROUP_MSENC, .reg = 0x264 },
1080 { .name = "ppcs", .swgroup = TEGRA_SWGROUP_PPCS, .reg = 0x270 },
1081 { .name = "sata", .swgroup = TEGRA_SWGROUP_SATA, .reg = 0x274 },
1082 { .name = "vde", .swgroup = TEGRA_SWGROUP_VDE, .reg = 0x27c },
1083 { .name = "isp2", .swgroup = TEGRA_SWGROUP_ISP2, .reg = 0x258 },
1084 { .name = "xusb_host", .swgroup = TEGRA_SWGROUP_XUSB_HOST, .reg = 0x288 },
1085 { .name = "xusb_dev", .swgroup = TEGRA_SWGROUP_XUSB_DEV, .reg = 0x28c },
1086 { .name = "isp2b", .swgroup = TEGRA_SWGROUP_ISP2B, .reg = 0xaa4 },
1087 { .name = "tsec", .swgroup = TEGRA_SWGROUP_TSEC, .reg = 0x294 },
1088 { .name = "a9avp", .swgroup = TEGRA_SWGROUP_A9AVP, .reg = 0x290 },
1089 { .name = "gpu", .swgroup = TEGRA_SWGROUP_GPU, .reg = 0xaac },
1090 { .name = "sdmmc1a", .swgroup = TEGRA_SWGROUP_SDMMC1A, .reg = 0xa94 },
1091 { .name = "sdmmc2a", .swgroup = TEGRA_SWGROUP_SDMMC2A, .reg = 0xa98 },
1092 { .name = "sdmmc3a", .swgroup = TEGRA_SWGROUP_SDMMC3A, .reg = 0xa9c },
1093 { .name = "sdmmc4a", .swgroup = TEGRA_SWGROUP_SDMMC4A, .reg = 0xaa0 },
1094 { .name = "vic", .swgroup = TEGRA_SWGROUP_VIC, .reg = 0x284 },
1095 { .name = "vi", .swgroup = TEGRA_SWGROUP_VI, .reg = 0x280 },
1096};
1097
1098static const unsigned int tegra124_group_drm[] = {
1099 TEGRA_SWGROUP_DC,
1100 TEGRA_SWGROUP_DCB,
1101 TEGRA_SWGROUP_VIC,
1102};
1103
1104static const struct tegra_smmu_group_soc tegra124_groups[] = {
1105 {
1106 .name = "drm",
1107 .swgroups = tegra124_group_drm,
1108 .num_swgroups = ARRAY_SIZE(tegra124_group_drm),
1109 },
1110};
1111
1112#define TEGRA124_MC_RESET(_name, _control, _status, _bit) \
1113 { \
1114 .name = #_name, \
1115 .id = TEGRA124_MC_RESET_##_name, \
1116 .control = _control, \
1117 .status = _status, \
1118 .bit = _bit, \
1119 }
1120
1121static const struct tegra_mc_reset tegra124_mc_resets[] = {
1122 TEGRA124_MC_RESET(AFI, 0x200, 0x204, 0),
1123 TEGRA124_MC_RESET(AVPC, 0x200, 0x204, 1),
1124 TEGRA124_MC_RESET(DC, 0x200, 0x204, 2),
1125 TEGRA124_MC_RESET(DCB, 0x200, 0x204, 3),
1126 TEGRA124_MC_RESET(HC, 0x200, 0x204, 6),
1127 TEGRA124_MC_RESET(HDA, 0x200, 0x204, 7),
1128 TEGRA124_MC_RESET(ISP2, 0x200, 0x204, 8),
1129 TEGRA124_MC_RESET(MPCORE, 0x200, 0x204, 9),
1130 TEGRA124_MC_RESET(MPCORELP, 0x200, 0x204, 10),
1131 TEGRA124_MC_RESET(MSENC, 0x200, 0x204, 11),
1132 TEGRA124_MC_RESET(PPCS, 0x200, 0x204, 14),
1133 TEGRA124_MC_RESET(SATA, 0x200, 0x204, 15),
1134 TEGRA124_MC_RESET(VDE, 0x200, 0x204, 16),
1135 TEGRA124_MC_RESET(VI, 0x200, 0x204, 17),
1136 TEGRA124_MC_RESET(VIC, 0x200, 0x204, 18),
1137 TEGRA124_MC_RESET(XUSB_HOST, 0x200, 0x204, 19),
1138 TEGRA124_MC_RESET(XUSB_DEV, 0x200, 0x204, 20),
1139 TEGRA124_MC_RESET(TSEC, 0x200, 0x204, 21),
1140 TEGRA124_MC_RESET(SDMMC1, 0x200, 0x204, 22),
1141 TEGRA124_MC_RESET(SDMMC2, 0x200, 0x204, 23),
1142 TEGRA124_MC_RESET(SDMMC3, 0x200, 0x204, 25),
1143 TEGRA124_MC_RESET(SDMMC4, 0x970, 0x974, 0),
1144 TEGRA124_MC_RESET(ISP2B, 0x970, 0x974, 1),
1145 TEGRA124_MC_RESET(GPU, 0x970, 0x974, 2),
1146};
1147
1148static int tegra124_mc_icc_set(struct icc_node *src, struct icc_node *dst)
1149{
1150 /* TODO: program PTSA */
1151 return 0;
1152}
1153
1154static int tegra124_mc_icc_aggreate(struct icc_node *node, u32 tag, u32 avg_bw,
1155 u32 peak_bw, u32 *agg_avg, u32 *agg_peak)
1156{
1157 /*
1158 * ISO clients need to reserve extra bandwidth up-front because
1159 * there could be high bandwidth pressure during initial filling
1160 * of the client's FIFO buffers. Secondly, we need to take into
1161 * account impurities of the memory subsystem.
1162 */
1163 if (tag & TEGRA_MC_ICC_TAG_ISO)
1164 peak_bw = tegra_mc_scale_percents(peak_bw, 400);
1165
1166 *agg_avg += avg_bw;
1167 *agg_peak = max(*agg_peak, peak_bw);
1168
1169 return 0;
1170}
1171
1172static struct icc_node_data *
1173tegra124_mc_of_icc_xlate_extended(struct of_phandle_args *spec, void *data)
1174{
1175 struct tegra_mc *mc = icc_provider_to_tegra_mc(data);
1176 const struct tegra_mc_client *client;
1177 unsigned int i, idx = spec->args[0];
1178 struct icc_node_data *ndata;
1179 struct icc_node *node;
1180
1181 list_for_each_entry(node, &mc->provider.nodes, node_list) {
1182 if (node->id != idx)
1183 continue;
1184
1185 ndata = kzalloc(sizeof(*ndata), GFP_KERNEL);
1186 if (!ndata)
1187 return ERR_PTR(-ENOMEM);
1188
1189 client = &mc->soc->clients[idx];
1190 ndata->node = node;
1191
1192 switch (client->swgroup) {
1193 case TEGRA_SWGROUP_DC:
1194 case TEGRA_SWGROUP_DCB:
1195 case TEGRA_SWGROUP_PTC:
1196 case TEGRA_SWGROUP_VI:
1197 /* these clients are isochronous by default */
1198 ndata->tag = TEGRA_MC_ICC_TAG_ISO;
1199 break;
1200
1201 default:
1202 ndata->tag = TEGRA_MC_ICC_TAG_DEFAULT;
1203 break;
1204 }
1205
1206 return ndata;
1207 }
1208
1209 for (i = 0; i < mc->soc->num_clients; i++) {
1210 if (mc->soc->clients[i].id == idx)
1211 return ERR_PTR(-EPROBE_DEFER);
1212 }
1213
1214 dev_err(mc->dev, "invalid ICC client ID %u\n", idx);
1215
1216 return ERR_PTR(-EINVAL);
1217}
1218
1219static const struct tegra_mc_icc_ops tegra124_mc_icc_ops = {
1220 .xlate_extended = tegra124_mc_of_icc_xlate_extended,
1221 .aggregate = tegra124_mc_icc_aggreate,
1222 .set = tegra124_mc_icc_set,
1223};
1224
1225#ifdef CONFIG_ARCH_TEGRA_124_SOC
1226static const unsigned long tegra124_mc_emem_regs[] = {
1227 MC_EMEM_ARB_CFG,
1228 MC_EMEM_ARB_OUTSTANDING_REQ,
1229 MC_EMEM_ARB_TIMING_RCD,
1230 MC_EMEM_ARB_TIMING_RP,
1231 MC_EMEM_ARB_TIMING_RC,
1232 MC_EMEM_ARB_TIMING_RAS,
1233 MC_EMEM_ARB_TIMING_FAW,
1234 MC_EMEM_ARB_TIMING_RRD,
1235 MC_EMEM_ARB_TIMING_RAP2PRE,
1236 MC_EMEM_ARB_TIMING_WAP2PRE,
1237 MC_EMEM_ARB_TIMING_R2R,
1238 MC_EMEM_ARB_TIMING_W2W,
1239 MC_EMEM_ARB_TIMING_R2W,
1240 MC_EMEM_ARB_TIMING_W2R,
1241 MC_EMEM_ARB_DA_TURNS,
1242 MC_EMEM_ARB_DA_COVERS,
1243 MC_EMEM_ARB_MISC0,
1244 MC_EMEM_ARB_MISC1,
1245 MC_EMEM_ARB_RING1_THROTTLE
1246};
1247
1248static const struct tegra_smmu_soc tegra124_smmu_soc = {
1249 .clients = tegra124_mc_clients,
1250 .num_clients = ARRAY_SIZE(tegra124_mc_clients),
1251 .swgroups = tegra124_swgroups,
1252 .num_swgroups = ARRAY_SIZE(tegra124_swgroups),
1253 .groups = tegra124_groups,
1254 .num_groups = ARRAY_SIZE(tegra124_groups),
1255 .supports_round_robin_arbitration = true,
1256 .supports_request_limit = true,
1257 .num_tlb_lines = 32,
1258 .num_asids = 128,
1259};
1260
1261const struct tegra_mc_soc tegra124_mc_soc = {
1262 .clients = tegra124_mc_clients,
1263 .num_clients = ARRAY_SIZE(tegra124_mc_clients),
1264 .num_address_bits = 34,
1265 .atom_size = 32,
1266 .client_id_mask = 0x7f,
1267 .smmu = &tegra124_smmu_soc,
1268 .emem_regs = tegra124_mc_emem_regs,
1269 .num_emem_regs = ARRAY_SIZE(tegra124_mc_emem_regs),
1270 .intmask = MC_INT_DECERR_MTS | MC_INT_SECERR_SEC | MC_INT_DECERR_VPR |
1271 MC_INT_INVALID_APB_ASID_UPDATE | MC_INT_INVALID_SMMU_PAGE |
1272 MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM,
1273 .reset_ops = &tegra_mc_reset_ops_common,
1274 .resets = tegra124_mc_resets,
1275 .num_resets = ARRAY_SIZE(tegra124_mc_resets),
1276 .icc_ops = &tegra124_mc_icc_ops,
1277 .ops = &tegra30_mc_ops,
1278};
1279#endif /* CONFIG_ARCH_TEGRA_124_SOC */
1280
1281#ifdef CONFIG_ARCH_TEGRA_132_SOC
1282static const struct tegra_smmu_soc tegra132_smmu_soc = {
1283 .clients = tegra124_mc_clients,
1284 .num_clients = ARRAY_SIZE(tegra124_mc_clients),
1285 .swgroups = tegra124_swgroups,
1286 .num_swgroups = ARRAY_SIZE(tegra124_swgroups),
1287 .groups = tegra124_groups,
1288 .num_groups = ARRAY_SIZE(tegra124_groups),
1289 .supports_round_robin_arbitration = true,
1290 .supports_request_limit = true,
1291 .num_tlb_lines = 32,
1292 .num_asids = 128,
1293};
1294
1295const struct tegra_mc_soc tegra132_mc_soc = {
1296 .clients = tegra124_mc_clients,
1297 .num_clients = ARRAY_SIZE(tegra124_mc_clients),
1298 .num_address_bits = 34,
1299 .atom_size = 32,
1300 .client_id_mask = 0x7f,
1301 .smmu = &tegra132_smmu_soc,
1302 .intmask = MC_INT_DECERR_MTS | MC_INT_SECERR_SEC | MC_INT_DECERR_VPR |
1303 MC_INT_INVALID_APB_ASID_UPDATE | MC_INT_INVALID_SMMU_PAGE |
1304 MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM,
1305 .reset_ops = &tegra_mc_reset_ops_common,
1306 .resets = tegra124_mc_resets,
1307 .num_resets = ARRAY_SIZE(tegra124_mc_resets),
1308 .icc_ops = &tegra124_mc_icc_ops,
1309 .ops = &tegra30_mc_ops,
1310};
1311#endif /* CONFIG_ARCH_TEGRA_132_SOC */
1/*
2 * Copyright (C) 2014 NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#include <linux/of.h>
10#include <linux/mm.h>
11
12#include <dt-bindings/memory/tegra124-mc.h>
13
14#include "mc.h"
15
16#define MC_EMEM_ARB_CFG 0x90
17#define MC_EMEM_ARB_OUTSTANDING_REQ 0x94
18#define MC_EMEM_ARB_TIMING_RCD 0x98
19#define MC_EMEM_ARB_TIMING_RP 0x9c
20#define MC_EMEM_ARB_TIMING_RC 0xa0
21#define MC_EMEM_ARB_TIMING_RAS 0xa4
22#define MC_EMEM_ARB_TIMING_FAW 0xa8
23#define MC_EMEM_ARB_TIMING_RRD 0xac
24#define MC_EMEM_ARB_TIMING_RAP2PRE 0xb0
25#define MC_EMEM_ARB_TIMING_WAP2PRE 0xb4
26#define MC_EMEM_ARB_TIMING_R2R 0xb8
27#define MC_EMEM_ARB_TIMING_W2W 0xbc
28#define MC_EMEM_ARB_TIMING_R2W 0xc0
29#define MC_EMEM_ARB_TIMING_W2R 0xc4
30#define MC_EMEM_ARB_DA_TURNS 0xd0
31#define MC_EMEM_ARB_DA_COVERS 0xd4
32#define MC_EMEM_ARB_MISC0 0xd8
33#define MC_EMEM_ARB_MISC1 0xdc
34#define MC_EMEM_ARB_RING1_THROTTLE 0xe0
35
36static const unsigned long tegra124_mc_emem_regs[] = {
37 MC_EMEM_ARB_CFG,
38 MC_EMEM_ARB_OUTSTANDING_REQ,
39 MC_EMEM_ARB_TIMING_RCD,
40 MC_EMEM_ARB_TIMING_RP,
41 MC_EMEM_ARB_TIMING_RC,
42 MC_EMEM_ARB_TIMING_RAS,
43 MC_EMEM_ARB_TIMING_FAW,
44 MC_EMEM_ARB_TIMING_RRD,
45 MC_EMEM_ARB_TIMING_RAP2PRE,
46 MC_EMEM_ARB_TIMING_WAP2PRE,
47 MC_EMEM_ARB_TIMING_R2R,
48 MC_EMEM_ARB_TIMING_W2W,
49 MC_EMEM_ARB_TIMING_R2W,
50 MC_EMEM_ARB_TIMING_W2R,
51 MC_EMEM_ARB_DA_TURNS,
52 MC_EMEM_ARB_DA_COVERS,
53 MC_EMEM_ARB_MISC0,
54 MC_EMEM_ARB_MISC1,
55 MC_EMEM_ARB_RING1_THROTTLE
56};
57
58static const struct tegra_mc_client tegra124_mc_clients[] = {
59 {
60 .id = 0x00,
61 .name = "ptcr",
62 .swgroup = TEGRA_SWGROUP_PTC,
63 }, {
64 .id = 0x01,
65 .name = "display0a",
66 .swgroup = TEGRA_SWGROUP_DC,
67 .smmu = {
68 .reg = 0x228,
69 .bit = 1,
70 },
71 .la = {
72 .reg = 0x2e8,
73 .shift = 0,
74 .mask = 0xff,
75 .def = 0xc2,
76 },
77 }, {
78 .id = 0x02,
79 .name = "display0ab",
80 .swgroup = TEGRA_SWGROUP_DCB,
81 .smmu = {
82 .reg = 0x228,
83 .bit = 2,
84 },
85 .la = {
86 .reg = 0x2f4,
87 .shift = 0,
88 .mask = 0xff,
89 .def = 0xc6,
90 },
91 }, {
92 .id = 0x03,
93 .name = "display0b",
94 .swgroup = TEGRA_SWGROUP_DC,
95 .smmu = {
96 .reg = 0x228,
97 .bit = 3,
98 },
99 .la = {
100 .reg = 0x2e8,
101 .shift = 16,
102 .mask = 0xff,
103 .def = 0x50,
104 },
105 }, {
106 .id = 0x04,
107 .name = "display0bb",
108 .swgroup = TEGRA_SWGROUP_DCB,
109 .smmu = {
110 .reg = 0x228,
111 .bit = 4,
112 },
113 .la = {
114 .reg = 0x2f4,
115 .shift = 16,
116 .mask = 0xff,
117 .def = 0x50,
118 },
119 }, {
120 .id = 0x05,
121 .name = "display0c",
122 .swgroup = TEGRA_SWGROUP_DC,
123 .smmu = {
124 .reg = 0x228,
125 .bit = 5,
126 },
127 .la = {
128 .reg = 0x2ec,
129 .shift = 0,
130 .mask = 0xff,
131 .def = 0x50,
132 },
133 }, {
134 .id = 0x06,
135 .name = "display0cb",
136 .swgroup = TEGRA_SWGROUP_DCB,
137 .smmu = {
138 .reg = 0x228,
139 .bit = 6,
140 },
141 .la = {
142 .reg = 0x2f8,
143 .shift = 0,
144 .mask = 0xff,
145 .def = 0x50,
146 },
147 }, {
148 .id = 0x0e,
149 .name = "afir",
150 .swgroup = TEGRA_SWGROUP_AFI,
151 .smmu = {
152 .reg = 0x228,
153 .bit = 14,
154 },
155 .la = {
156 .reg = 0x2e0,
157 .shift = 0,
158 .mask = 0xff,
159 .def = 0x13,
160 },
161 }, {
162 .id = 0x0f,
163 .name = "avpcarm7r",
164 .swgroup = TEGRA_SWGROUP_AVPC,
165 .smmu = {
166 .reg = 0x228,
167 .bit = 15,
168 },
169 .la = {
170 .reg = 0x2e4,
171 .shift = 0,
172 .mask = 0xff,
173 .def = 0x04,
174 },
175 }, {
176 .id = 0x10,
177 .name = "displayhc",
178 .swgroup = TEGRA_SWGROUP_DC,
179 .smmu = {
180 .reg = 0x228,
181 .bit = 16,
182 },
183 .la = {
184 .reg = 0x2f0,
185 .shift = 0,
186 .mask = 0xff,
187 .def = 0x50,
188 },
189 }, {
190 .id = 0x11,
191 .name = "displayhcb",
192 .swgroup = TEGRA_SWGROUP_DCB,
193 .smmu = {
194 .reg = 0x228,
195 .bit = 17,
196 },
197 .la = {
198 .reg = 0x2fc,
199 .shift = 0,
200 .mask = 0xff,
201 .def = 0x50,
202 },
203 }, {
204 .id = 0x15,
205 .name = "hdar",
206 .swgroup = TEGRA_SWGROUP_HDA,
207 .smmu = {
208 .reg = 0x228,
209 .bit = 21,
210 },
211 .la = {
212 .reg = 0x318,
213 .shift = 0,
214 .mask = 0xff,
215 .def = 0x24,
216 },
217 }, {
218 .id = 0x16,
219 .name = "host1xdmar",
220 .swgroup = TEGRA_SWGROUP_HC,
221 .smmu = {
222 .reg = 0x228,
223 .bit = 22,
224 },
225 .la = {
226 .reg = 0x310,
227 .shift = 0,
228 .mask = 0xff,
229 .def = 0x1e,
230 },
231 }, {
232 .id = 0x17,
233 .name = "host1xr",
234 .swgroup = TEGRA_SWGROUP_HC,
235 .smmu = {
236 .reg = 0x228,
237 .bit = 23,
238 },
239 .la = {
240 .reg = 0x310,
241 .shift = 16,
242 .mask = 0xff,
243 .def = 0x50,
244 },
245 }, {
246 .id = 0x1c,
247 .name = "msencsrd",
248 .swgroup = TEGRA_SWGROUP_MSENC,
249 .smmu = {
250 .reg = 0x228,
251 .bit = 28,
252 },
253 .la = {
254 .reg = 0x328,
255 .shift = 0,
256 .mask = 0xff,
257 .def = 0x23,
258 },
259 }, {
260 .id = 0x1d,
261 .name = "ppcsahbdmar",
262 .swgroup = TEGRA_SWGROUP_PPCS,
263 .smmu = {
264 .reg = 0x228,
265 .bit = 29,
266 },
267 .la = {
268 .reg = 0x344,
269 .shift = 0,
270 .mask = 0xff,
271 .def = 0x49,
272 },
273 }, {
274 .id = 0x1e,
275 .name = "ppcsahbslvr",
276 .swgroup = TEGRA_SWGROUP_PPCS,
277 .smmu = {
278 .reg = 0x228,
279 .bit = 30,
280 },
281 .la = {
282 .reg = 0x344,
283 .shift = 16,
284 .mask = 0xff,
285 .def = 0x1a,
286 },
287 }, {
288 .id = 0x1f,
289 .name = "satar",
290 .swgroup = TEGRA_SWGROUP_SATA,
291 .smmu = {
292 .reg = 0x228,
293 .bit = 31,
294 },
295 .la = {
296 .reg = 0x350,
297 .shift = 0,
298 .mask = 0xff,
299 .def = 0x65,
300 },
301 }, {
302 .id = 0x22,
303 .name = "vdebsevr",
304 .swgroup = TEGRA_SWGROUP_VDE,
305 .smmu = {
306 .reg = 0x22c,
307 .bit = 2,
308 },
309 .la = {
310 .reg = 0x354,
311 .shift = 0,
312 .mask = 0xff,
313 .def = 0x4f,
314 },
315 }, {
316 .id = 0x23,
317 .name = "vdember",
318 .swgroup = TEGRA_SWGROUP_VDE,
319 .smmu = {
320 .reg = 0x22c,
321 .bit = 3,
322 },
323 .la = {
324 .reg = 0x354,
325 .shift = 16,
326 .mask = 0xff,
327 .def = 0x3d,
328 },
329 }, {
330 .id = 0x24,
331 .name = "vdemcer",
332 .swgroup = TEGRA_SWGROUP_VDE,
333 .smmu = {
334 .reg = 0x22c,
335 .bit = 4,
336 },
337 .la = {
338 .reg = 0x358,
339 .shift = 0,
340 .mask = 0xff,
341 .def = 0x66,
342 },
343 }, {
344 .id = 0x25,
345 .name = "vdetper",
346 .swgroup = TEGRA_SWGROUP_VDE,
347 .smmu = {
348 .reg = 0x22c,
349 .bit = 5,
350 },
351 .la = {
352 .reg = 0x358,
353 .shift = 16,
354 .mask = 0xff,
355 .def = 0xa5,
356 },
357 }, {
358 .id = 0x26,
359 .name = "mpcorelpr",
360 .swgroup = TEGRA_SWGROUP_MPCORELP,
361 .la = {
362 .reg = 0x324,
363 .shift = 0,
364 .mask = 0xff,
365 .def = 0x04,
366 },
367 }, {
368 .id = 0x27,
369 .name = "mpcorer",
370 .swgroup = TEGRA_SWGROUP_MPCORE,
371 .la = {
372 .reg = 0x320,
373 .shift = 0,
374 .mask = 0xff,
375 .def = 0x04,
376 },
377 }, {
378 .id = 0x2b,
379 .name = "msencswr",
380 .swgroup = TEGRA_SWGROUP_MSENC,
381 .smmu = {
382 .reg = 0x22c,
383 .bit = 11,
384 },
385 .la = {
386 .reg = 0x328,
387 .shift = 16,
388 .mask = 0xff,
389 .def = 0x80,
390 },
391 }, {
392 .id = 0x31,
393 .name = "afiw",
394 .swgroup = TEGRA_SWGROUP_AFI,
395 .smmu = {
396 .reg = 0x22c,
397 .bit = 17,
398 },
399 .la = {
400 .reg = 0x2e0,
401 .shift = 16,
402 .mask = 0xff,
403 .def = 0x80,
404 },
405 }, {
406 .id = 0x32,
407 .name = "avpcarm7w",
408 .swgroup = TEGRA_SWGROUP_AVPC,
409 .smmu = {
410 .reg = 0x22c,
411 .bit = 18,
412 },
413 .la = {
414 .reg = 0x2e4,
415 .shift = 16,
416 .mask = 0xff,
417 .def = 0x80,
418 },
419 }, {
420 .id = 0x35,
421 .name = "hdaw",
422 .swgroup = TEGRA_SWGROUP_HDA,
423 .smmu = {
424 .reg = 0x22c,
425 .bit = 21,
426 },
427 .la = {
428 .reg = 0x318,
429 .shift = 16,
430 .mask = 0xff,
431 .def = 0x80,
432 },
433 }, {
434 .id = 0x36,
435 .name = "host1xw",
436 .swgroup = TEGRA_SWGROUP_HC,
437 .smmu = {
438 .reg = 0x22c,
439 .bit = 22,
440 },
441 .la = {
442 .reg = 0x314,
443 .shift = 0,
444 .mask = 0xff,
445 .def = 0x80,
446 },
447 }, {
448 .id = 0x38,
449 .name = "mpcorelpw",
450 .swgroup = TEGRA_SWGROUP_MPCORELP,
451 .la = {
452 .reg = 0x324,
453 .shift = 16,
454 .mask = 0xff,
455 .def = 0x80,
456 },
457 }, {
458 .id = 0x39,
459 .name = "mpcorew",
460 .swgroup = TEGRA_SWGROUP_MPCORE,
461 .la = {
462 .reg = 0x320,
463 .shift = 16,
464 .mask = 0xff,
465 .def = 0x80,
466 },
467 }, {
468 .id = 0x3b,
469 .name = "ppcsahbdmaw",
470 .swgroup = TEGRA_SWGROUP_PPCS,
471 .smmu = {
472 .reg = 0x22c,
473 .bit = 27,
474 },
475 .la = {
476 .reg = 0x348,
477 .shift = 0,
478 .mask = 0xff,
479 .def = 0x80,
480 },
481 }, {
482 .id = 0x3c,
483 .name = "ppcsahbslvw",
484 .swgroup = TEGRA_SWGROUP_PPCS,
485 .smmu = {
486 .reg = 0x22c,
487 .bit = 28,
488 },
489 .la = {
490 .reg = 0x348,
491 .shift = 16,
492 .mask = 0xff,
493 .def = 0x80,
494 },
495 }, {
496 .id = 0x3d,
497 .name = "sataw",
498 .swgroup = TEGRA_SWGROUP_SATA,
499 .smmu = {
500 .reg = 0x22c,
501 .bit = 29,
502 },
503 .la = {
504 .reg = 0x350,
505 .shift = 16,
506 .mask = 0xff,
507 .def = 0x65,
508 },
509 }, {
510 .id = 0x3e,
511 .name = "vdebsevw",
512 .swgroup = TEGRA_SWGROUP_VDE,
513 .smmu = {
514 .reg = 0x22c,
515 .bit = 30,
516 },
517 .la = {
518 .reg = 0x35c,
519 .shift = 0,
520 .mask = 0xff,
521 .def = 0x80,
522 },
523 }, {
524 .id = 0x3f,
525 .name = "vdedbgw",
526 .swgroup = TEGRA_SWGROUP_VDE,
527 .smmu = {
528 .reg = 0x22c,
529 .bit = 31,
530 },
531 .la = {
532 .reg = 0x35c,
533 .shift = 16,
534 .mask = 0xff,
535 .def = 0x80,
536 },
537 }, {
538 .id = 0x40,
539 .name = "vdembew",
540 .swgroup = TEGRA_SWGROUP_VDE,
541 .smmu = {
542 .reg = 0x230,
543 .bit = 0,
544 },
545 .la = {
546 .reg = 0x360,
547 .shift = 0,
548 .mask = 0xff,
549 .def = 0x80,
550 },
551 }, {
552 .id = 0x41,
553 .name = "vdetpmw",
554 .swgroup = TEGRA_SWGROUP_VDE,
555 .smmu = {
556 .reg = 0x230,
557 .bit = 1,
558 },
559 .la = {
560 .reg = 0x360,
561 .shift = 16,
562 .mask = 0xff,
563 .def = 0x80,
564 },
565 }, {
566 .id = 0x44,
567 .name = "ispra",
568 .swgroup = TEGRA_SWGROUP_ISP2,
569 .smmu = {
570 .reg = 0x230,
571 .bit = 4,
572 },
573 .la = {
574 .reg = 0x370,
575 .shift = 0,
576 .mask = 0xff,
577 .def = 0x18,
578 },
579 }, {
580 .id = 0x46,
581 .name = "ispwa",
582 .swgroup = TEGRA_SWGROUP_ISP2,
583 .smmu = {
584 .reg = 0x230,
585 .bit = 6,
586 },
587 .la = {
588 .reg = 0x374,
589 .shift = 0,
590 .mask = 0xff,
591 .def = 0x80,
592 },
593 }, {
594 .id = 0x47,
595 .name = "ispwb",
596 .swgroup = TEGRA_SWGROUP_ISP2,
597 .smmu = {
598 .reg = 0x230,
599 .bit = 7,
600 },
601 .la = {
602 .reg = 0x374,
603 .shift = 16,
604 .mask = 0xff,
605 .def = 0x80,
606 },
607 }, {
608 .id = 0x4a,
609 .name = "xusb_hostr",
610 .swgroup = TEGRA_SWGROUP_XUSB_HOST,
611 .smmu = {
612 .reg = 0x230,
613 .bit = 10,
614 },
615 .la = {
616 .reg = 0x37c,
617 .shift = 0,
618 .mask = 0xff,
619 .def = 0x39,
620 },
621 }, {
622 .id = 0x4b,
623 .name = "xusb_hostw",
624 .swgroup = TEGRA_SWGROUP_XUSB_HOST,
625 .smmu = {
626 .reg = 0x230,
627 .bit = 11,
628 },
629 .la = {
630 .reg = 0x37c,
631 .shift = 16,
632 .mask = 0xff,
633 .def = 0x80,
634 },
635 }, {
636 .id = 0x4c,
637 .name = "xusb_devr",
638 .swgroup = TEGRA_SWGROUP_XUSB_DEV,
639 .smmu = {
640 .reg = 0x230,
641 .bit = 12,
642 },
643 .la = {
644 .reg = 0x380,
645 .shift = 0,
646 .mask = 0xff,
647 .def = 0x39,
648 },
649 }, {
650 .id = 0x4d,
651 .name = "xusb_devw",
652 .swgroup = TEGRA_SWGROUP_XUSB_DEV,
653 .smmu = {
654 .reg = 0x230,
655 .bit = 13,
656 },
657 .la = {
658 .reg = 0x380,
659 .shift = 16,
660 .mask = 0xff,
661 .def = 0x80,
662 },
663 }, {
664 .id = 0x4e,
665 .name = "isprab",
666 .swgroup = TEGRA_SWGROUP_ISP2B,
667 .smmu = {
668 .reg = 0x230,
669 .bit = 14,
670 },
671 .la = {
672 .reg = 0x384,
673 .shift = 0,
674 .mask = 0xff,
675 .def = 0x18,
676 },
677 }, {
678 .id = 0x50,
679 .name = "ispwab",
680 .swgroup = TEGRA_SWGROUP_ISP2B,
681 .smmu = {
682 .reg = 0x230,
683 .bit = 16,
684 },
685 .la = {
686 .reg = 0x388,
687 .shift = 0,
688 .mask = 0xff,
689 .def = 0x80,
690 },
691 }, {
692 .id = 0x51,
693 .name = "ispwbb",
694 .swgroup = TEGRA_SWGROUP_ISP2B,
695 .smmu = {
696 .reg = 0x230,
697 .bit = 17,
698 },
699 .la = {
700 .reg = 0x388,
701 .shift = 16,
702 .mask = 0xff,
703 .def = 0x80,
704 },
705 }, {
706 .id = 0x54,
707 .name = "tsecsrd",
708 .swgroup = TEGRA_SWGROUP_TSEC,
709 .smmu = {
710 .reg = 0x230,
711 .bit = 20,
712 },
713 .la = {
714 .reg = 0x390,
715 .shift = 0,
716 .mask = 0xff,
717 .def = 0x9b,
718 },
719 }, {
720 .id = 0x55,
721 .name = "tsecswr",
722 .swgroup = TEGRA_SWGROUP_TSEC,
723 .smmu = {
724 .reg = 0x230,
725 .bit = 21,
726 },
727 .la = {
728 .reg = 0x390,
729 .shift = 16,
730 .mask = 0xff,
731 .def = 0x80,
732 },
733 }, {
734 .id = 0x56,
735 .name = "a9avpscr",
736 .swgroup = TEGRA_SWGROUP_A9AVP,
737 .smmu = {
738 .reg = 0x230,
739 .bit = 22,
740 },
741 .la = {
742 .reg = 0x3a4,
743 .shift = 0,
744 .mask = 0xff,
745 .def = 0x04,
746 },
747 }, {
748 .id = 0x57,
749 .name = "a9avpscw",
750 .swgroup = TEGRA_SWGROUP_A9AVP,
751 .smmu = {
752 .reg = 0x230,
753 .bit = 23,
754 },
755 .la = {
756 .reg = 0x3a4,
757 .shift = 16,
758 .mask = 0xff,
759 .def = 0x80,
760 },
761 }, {
762 .id = 0x58,
763 .name = "gpusrd",
764 .swgroup = TEGRA_SWGROUP_GPU,
765 .smmu = {
766 /* read-only */
767 .reg = 0x230,
768 .bit = 24,
769 },
770 .la = {
771 .reg = 0x3c8,
772 .shift = 0,
773 .mask = 0xff,
774 .def = 0x1a,
775 },
776 }, {
777 .id = 0x59,
778 .name = "gpuswr",
779 .swgroup = TEGRA_SWGROUP_GPU,
780 .smmu = {
781 /* read-only */
782 .reg = 0x230,
783 .bit = 25,
784 },
785 .la = {
786 .reg = 0x3c8,
787 .shift = 16,
788 .mask = 0xff,
789 .def = 0x80,
790 },
791 }, {
792 .id = 0x5a,
793 .name = "displayt",
794 .swgroup = TEGRA_SWGROUP_DC,
795 .smmu = {
796 .reg = 0x230,
797 .bit = 26,
798 },
799 .la = {
800 .reg = 0x2f0,
801 .shift = 16,
802 .mask = 0xff,
803 .def = 0x50,
804 },
805 }, {
806 .id = 0x60,
807 .name = "sdmmcra",
808 .swgroup = TEGRA_SWGROUP_SDMMC1A,
809 .smmu = {
810 .reg = 0x234,
811 .bit = 0,
812 },
813 .la = {
814 .reg = 0x3b8,
815 .shift = 0,
816 .mask = 0xff,
817 .def = 0x49,
818 },
819 }, {
820 .id = 0x61,
821 .name = "sdmmcraa",
822 .swgroup = TEGRA_SWGROUP_SDMMC2A,
823 .smmu = {
824 .reg = 0x234,
825 .bit = 1,
826 },
827 .la = {
828 .reg = 0x3bc,
829 .shift = 0,
830 .mask = 0xff,
831 .def = 0x49,
832 },
833 }, {
834 .id = 0x62,
835 .name = "sdmmcr",
836 .swgroup = TEGRA_SWGROUP_SDMMC3A,
837 .smmu = {
838 .reg = 0x234,
839 .bit = 2,
840 },
841 .la = {
842 .reg = 0x3c0,
843 .shift = 0,
844 .mask = 0xff,
845 .def = 0x49,
846 },
847 }, {
848 .id = 0x63,
849 .swgroup = TEGRA_SWGROUP_SDMMC4A,
850 .name = "sdmmcrab",
851 .smmu = {
852 .reg = 0x234,
853 .bit = 3,
854 },
855 .la = {
856 .reg = 0x3c4,
857 .shift = 0,
858 .mask = 0xff,
859 .def = 0x49,
860 },
861 }, {
862 .id = 0x64,
863 .name = "sdmmcwa",
864 .swgroup = TEGRA_SWGROUP_SDMMC1A,
865 .smmu = {
866 .reg = 0x234,
867 .bit = 4,
868 },
869 .la = {
870 .reg = 0x3b8,
871 .shift = 16,
872 .mask = 0xff,
873 .def = 0x80,
874 },
875 }, {
876 .id = 0x65,
877 .name = "sdmmcwaa",
878 .swgroup = TEGRA_SWGROUP_SDMMC2A,
879 .smmu = {
880 .reg = 0x234,
881 .bit = 5,
882 },
883 .la = {
884 .reg = 0x3bc,
885 .shift = 16,
886 .mask = 0xff,
887 .def = 0x80,
888 },
889 }, {
890 .id = 0x66,
891 .name = "sdmmcw",
892 .swgroup = TEGRA_SWGROUP_SDMMC3A,
893 .smmu = {
894 .reg = 0x234,
895 .bit = 6,
896 },
897 .la = {
898 .reg = 0x3c0,
899 .shift = 16,
900 .mask = 0xff,
901 .def = 0x80,
902 },
903 }, {
904 .id = 0x67,
905 .name = "sdmmcwab",
906 .swgroup = TEGRA_SWGROUP_SDMMC4A,
907 .smmu = {
908 .reg = 0x234,
909 .bit = 7,
910 },
911 .la = {
912 .reg = 0x3c4,
913 .shift = 16,
914 .mask = 0xff,
915 .def = 0x80,
916 },
917 }, {
918 .id = 0x6c,
919 .name = "vicsrd",
920 .swgroup = TEGRA_SWGROUP_VIC,
921 .smmu = {
922 .reg = 0x234,
923 .bit = 12,
924 },
925 .la = {
926 .reg = 0x394,
927 .shift = 0,
928 .mask = 0xff,
929 .def = 0x1a,
930 },
931 }, {
932 .id = 0x6d,
933 .name = "vicswr",
934 .swgroup = TEGRA_SWGROUP_VIC,
935 .smmu = {
936 .reg = 0x234,
937 .bit = 13,
938 },
939 .la = {
940 .reg = 0x394,
941 .shift = 16,
942 .mask = 0xff,
943 .def = 0x80,
944 },
945 }, {
946 .id = 0x72,
947 .name = "viw",
948 .swgroup = TEGRA_SWGROUP_VI,
949 .smmu = {
950 .reg = 0x234,
951 .bit = 18,
952 },
953 .la = {
954 .reg = 0x398,
955 .shift = 0,
956 .mask = 0xff,
957 .def = 0x80,
958 },
959 }, {
960 .id = 0x73,
961 .name = "displayd",
962 .swgroup = TEGRA_SWGROUP_DC,
963 .smmu = {
964 .reg = 0x234,
965 .bit = 19,
966 },
967 .la = {
968 .reg = 0x3c8,
969 .shift = 0,
970 .mask = 0xff,
971 .def = 0x50,
972 },
973 },
974};
975
976static const struct tegra_smmu_swgroup tegra124_swgroups[] = {
977 { .name = "dc", .swgroup = TEGRA_SWGROUP_DC, .reg = 0x240 },
978 { .name = "dcb", .swgroup = TEGRA_SWGROUP_DCB, .reg = 0x244 },
979 { .name = "afi", .swgroup = TEGRA_SWGROUP_AFI, .reg = 0x238 },
980 { .name = "avpc", .swgroup = TEGRA_SWGROUP_AVPC, .reg = 0x23c },
981 { .name = "hda", .swgroup = TEGRA_SWGROUP_HDA, .reg = 0x254 },
982 { .name = "hc", .swgroup = TEGRA_SWGROUP_HC, .reg = 0x250 },
983 { .name = "msenc", .swgroup = TEGRA_SWGROUP_MSENC, .reg = 0x264 },
984 { .name = "ppcs", .swgroup = TEGRA_SWGROUP_PPCS, .reg = 0x270 },
985 { .name = "sata", .swgroup = TEGRA_SWGROUP_SATA, .reg = 0x274 },
986 { .name = "vde", .swgroup = TEGRA_SWGROUP_VDE, .reg = 0x27c },
987 { .name = "isp2", .swgroup = TEGRA_SWGROUP_ISP2, .reg = 0x258 },
988 { .name = "xusb_host", .swgroup = TEGRA_SWGROUP_XUSB_HOST, .reg = 0x288 },
989 { .name = "xusb_dev", .swgroup = TEGRA_SWGROUP_XUSB_DEV, .reg = 0x28c },
990 { .name = "isp2b", .swgroup = TEGRA_SWGROUP_ISP2B, .reg = 0xaa4 },
991 { .name = "tsec", .swgroup = TEGRA_SWGROUP_TSEC, .reg = 0x294 },
992 { .name = "a9avp", .swgroup = TEGRA_SWGROUP_A9AVP, .reg = 0x290 },
993 { .name = "gpu", .swgroup = TEGRA_SWGROUP_GPU, .reg = 0xaac },
994 { .name = "sdmmc1a", .swgroup = TEGRA_SWGROUP_SDMMC1A, .reg = 0xa94 },
995 { .name = "sdmmc2a", .swgroup = TEGRA_SWGROUP_SDMMC2A, .reg = 0xa98 },
996 { .name = "sdmmc3a", .swgroup = TEGRA_SWGROUP_SDMMC3A, .reg = 0xa9c },
997 { .name = "sdmmc4a", .swgroup = TEGRA_SWGROUP_SDMMC4A, .reg = 0xaa0 },
998 { .name = "vic", .swgroup = TEGRA_SWGROUP_VIC, .reg = 0x284 },
999 { .name = "vi", .swgroup = TEGRA_SWGROUP_VI, .reg = 0x280 },
1000};
1001
1002static const unsigned int tegra124_group_display[] = {
1003 TEGRA_SWGROUP_DC,
1004 TEGRA_SWGROUP_DCB,
1005};
1006
1007static const struct tegra_smmu_group_soc tegra124_groups[] = {
1008 {
1009 .name = "display",
1010 .swgroups = tegra124_group_display,
1011 .num_swgroups = ARRAY_SIZE(tegra124_group_display),
1012 },
1013};
1014
1015#ifdef CONFIG_ARCH_TEGRA_124_SOC
1016static const struct tegra_smmu_soc tegra124_smmu_soc = {
1017 .clients = tegra124_mc_clients,
1018 .num_clients = ARRAY_SIZE(tegra124_mc_clients),
1019 .swgroups = tegra124_swgroups,
1020 .num_swgroups = ARRAY_SIZE(tegra124_swgroups),
1021 .groups = tegra124_groups,
1022 .num_groups = ARRAY_SIZE(tegra124_groups),
1023 .supports_round_robin_arbitration = true,
1024 .supports_request_limit = true,
1025 .num_tlb_lines = 32,
1026 .num_asids = 128,
1027};
1028
1029const struct tegra_mc_soc tegra124_mc_soc = {
1030 .clients = tegra124_mc_clients,
1031 .num_clients = ARRAY_SIZE(tegra124_mc_clients),
1032 .num_address_bits = 34,
1033 .atom_size = 32,
1034 .client_id_mask = 0x7f,
1035 .smmu = &tegra124_smmu_soc,
1036 .emem_regs = tegra124_mc_emem_regs,
1037 .num_emem_regs = ARRAY_SIZE(tegra124_mc_emem_regs),
1038};
1039#endif /* CONFIG_ARCH_TEGRA_124_SOC */
1040
1041#ifdef CONFIG_ARCH_TEGRA_132_SOC
1042static const struct tegra_smmu_soc tegra132_smmu_soc = {
1043 .clients = tegra124_mc_clients,
1044 .num_clients = ARRAY_SIZE(tegra124_mc_clients),
1045 .swgroups = tegra124_swgroups,
1046 .num_swgroups = ARRAY_SIZE(tegra124_swgroups),
1047 .groups = tegra124_groups,
1048 .num_groups = ARRAY_SIZE(tegra124_groups),
1049 .supports_round_robin_arbitration = true,
1050 .supports_request_limit = true,
1051 .num_tlb_lines = 32,
1052 .num_asids = 128,
1053};
1054
1055const struct tegra_mc_soc tegra132_mc_soc = {
1056 .clients = tegra124_mc_clients,
1057 .num_clients = ARRAY_SIZE(tegra124_mc_clients),
1058 .num_address_bits = 34,
1059 .atom_size = 32,
1060 .client_id_mask = 0x7f,
1061 .smmu = &tegra132_smmu_soc,
1062};
1063#endif /* CONFIG_ARCH_TEGRA_132_SOC */