2 * Copyright (C) 2014 NVIDIA CORPORATION. All rights reserved.
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.
12 #include <dt-bindings/memory/tegra124-mc.h>
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
36 static const struct tegra_mc_client tegra124_mc_clients[] = {
40 .swgroup = TEGRA_SWGROUP_PTC,
44 .swgroup = TEGRA_SWGROUP_DC,
58 .swgroup = TEGRA_SWGROUP_DCB,
72 .swgroup = TEGRA_SWGROUP_DC,
86 .swgroup = TEGRA_SWGROUP_DCB,
100 .swgroup = TEGRA_SWGROUP_DC,
113 .name = "display0cb",
114 .swgroup = TEGRA_SWGROUP_DCB,
128 .swgroup = TEGRA_SWGROUP_AFI,
142 .swgroup = TEGRA_SWGROUP_AVPC,
156 .swgroup = TEGRA_SWGROUP_DC,
169 .name = "displayhcb",
170 .swgroup = TEGRA_SWGROUP_DCB,
184 .swgroup = TEGRA_SWGROUP_HDA,
197 .name = "host1xdmar",
198 .swgroup = TEGRA_SWGROUP_HC,
212 .swgroup = TEGRA_SWGROUP_HC,
226 .swgroup = TEGRA_SWGROUP_MSENC,
239 .name = "ppcsahbdmar",
240 .swgroup = TEGRA_SWGROUP_PPCS,
253 .name = "ppcsahbslvr",
254 .swgroup = TEGRA_SWGROUP_PPCS,
268 .swgroup = TEGRA_SWGROUP_SATA,
282 .swgroup = TEGRA_SWGROUP_VDE,
296 .swgroup = TEGRA_SWGROUP_VDE,
310 .swgroup = TEGRA_SWGROUP_VDE,
324 .swgroup = TEGRA_SWGROUP_VDE,
338 .swgroup = TEGRA_SWGROUP_MPCORELP,
348 .swgroup = TEGRA_SWGROUP_MPCORE,
358 .swgroup = TEGRA_SWGROUP_MSENC,
372 .swgroup = TEGRA_SWGROUP_AFI,
386 .swgroup = TEGRA_SWGROUP_AVPC,
400 .swgroup = TEGRA_SWGROUP_HDA,
414 .swgroup = TEGRA_SWGROUP_HC,
428 .swgroup = TEGRA_SWGROUP_MPCORELP,
438 .swgroup = TEGRA_SWGROUP_MPCORE,
447 .name = "ppcsahbdmaw",
448 .swgroup = TEGRA_SWGROUP_PPCS,
461 .name = "ppcsahbslvw",
462 .swgroup = TEGRA_SWGROUP_PPCS,
476 .swgroup = TEGRA_SWGROUP_SATA,
490 .swgroup = TEGRA_SWGROUP_VDE,
504 .swgroup = TEGRA_SWGROUP_VDE,
518 .swgroup = TEGRA_SWGROUP_VDE,
532 .swgroup = TEGRA_SWGROUP_VDE,
546 .swgroup = TEGRA_SWGROUP_ISP2,
560 .swgroup = TEGRA_SWGROUP_ISP2,
574 .swgroup = TEGRA_SWGROUP_ISP2,
587 .name = "xusb_hostr",
588 .swgroup = TEGRA_SWGROUP_XUSB_HOST,
601 .name = "xusb_hostw",
602 .swgroup = TEGRA_SWGROUP_XUSB_HOST,
616 .swgroup = TEGRA_SWGROUP_XUSB_DEV,
630 .swgroup = TEGRA_SWGROUP_XUSB_DEV,
644 .swgroup = TEGRA_SWGROUP_ISP2B,
658 .swgroup = TEGRA_SWGROUP_ISP2B,
672 .swgroup = TEGRA_SWGROUP_ISP2B,
686 .swgroup = TEGRA_SWGROUP_TSEC,
700 .swgroup = TEGRA_SWGROUP_TSEC,
714 .swgroup = TEGRA_SWGROUP_A9AVP,
728 .swgroup = TEGRA_SWGROUP_A9AVP,
742 .swgroup = TEGRA_SWGROUP_GPU,
757 .swgroup = TEGRA_SWGROUP_GPU,
772 .swgroup = TEGRA_SWGROUP_DC,
786 .swgroup = TEGRA_SWGROUP_SDMMC1A,
800 .swgroup = TEGRA_SWGROUP_SDMMC2A,
814 .swgroup = TEGRA_SWGROUP_SDMMC3A,
827 .swgroup = TEGRA_SWGROUP_SDMMC4A,
842 .swgroup = TEGRA_SWGROUP_SDMMC1A,
856 .swgroup = TEGRA_SWGROUP_SDMMC2A,
870 .swgroup = TEGRA_SWGROUP_SDMMC3A,
884 .swgroup = TEGRA_SWGROUP_SDMMC4A,
898 .swgroup = TEGRA_SWGROUP_VIC,
912 .swgroup = TEGRA_SWGROUP_VIC,
926 .swgroup = TEGRA_SWGROUP_VI,
940 .swgroup = TEGRA_SWGROUP_DC,
954 static const struct tegra_smmu_swgroup tegra124_swgroups[] = {
955 { .name = "dc", .swgroup = TEGRA_SWGROUP_DC, .reg = 0x240 },
956 { .name = "dcb", .swgroup = TEGRA_SWGROUP_DCB, .reg = 0x244 },
957 { .name = "afi", .swgroup = TEGRA_SWGROUP_AFI, .reg = 0x238 },
958 { .name = "avpc", .swgroup = TEGRA_SWGROUP_AVPC, .reg = 0x23c },
959 { .name = "hda", .swgroup = TEGRA_SWGROUP_HDA, .reg = 0x254 },
960 { .name = "hc", .swgroup = TEGRA_SWGROUP_HC, .reg = 0x250 },
961 { .name = "msenc", .swgroup = TEGRA_SWGROUP_MSENC, .reg = 0x264 },
962 { .name = "ppcs", .swgroup = TEGRA_SWGROUP_PPCS, .reg = 0x270 },
963 { .name = "sata", .swgroup = TEGRA_SWGROUP_SATA, .reg = 0x274 },
964 { .name = "vde", .swgroup = TEGRA_SWGROUP_VDE, .reg = 0x27c },
965 { .name = "isp2", .swgroup = TEGRA_SWGROUP_ISP2, .reg = 0x258 },
966 { .name = "xusb_host", .swgroup = TEGRA_SWGROUP_XUSB_HOST, .reg = 0x288 },
967 { .name = "xusb_dev", .swgroup = TEGRA_SWGROUP_XUSB_DEV, .reg = 0x28c },
968 { .name = "isp2b", .swgroup = TEGRA_SWGROUP_ISP2B, .reg = 0xaa4 },
969 { .name = "tsec", .swgroup = TEGRA_SWGROUP_TSEC, .reg = 0x294 },
970 { .name = "a9avp", .swgroup = TEGRA_SWGROUP_A9AVP, .reg = 0x290 },
971 { .name = "gpu", .swgroup = TEGRA_SWGROUP_GPU, .reg = 0xaac },
972 { .name = "sdmmc1a", .swgroup = TEGRA_SWGROUP_SDMMC1A, .reg = 0xa94 },
973 { .name = "sdmmc2a", .swgroup = TEGRA_SWGROUP_SDMMC2A, .reg = 0xa98 },
974 { .name = "sdmmc3a", .swgroup = TEGRA_SWGROUP_SDMMC3A, .reg = 0xa9c },
975 { .name = "sdmmc4a", .swgroup = TEGRA_SWGROUP_SDMMC4A, .reg = 0xaa0 },
976 { .name = "vic", .swgroup = TEGRA_SWGROUP_VIC, .reg = 0x284 },
977 { .name = "vi", .swgroup = TEGRA_SWGROUP_VI, .reg = 0x280 },
980 static const unsigned int tegra124_group_display[] = {
985 static const struct tegra_smmu_group_soc tegra124_groups[] = {
988 .swgroups = tegra124_group_display,
989 .num_swgroups = ARRAY_SIZE(tegra124_group_display),
993 #define TEGRA124_MC_RESET(_name, _control, _status, _bit) \
996 .id = TEGRA124_MC_RESET_##_name, \
997 .control = _control, \
1002 static const struct tegra_mc_reset tegra124_mc_resets[] = {
1003 TEGRA124_MC_RESET(AFI, 0x200, 0x204, 0),
1004 TEGRA124_MC_RESET(AVPC, 0x200, 0x204, 1),
1005 TEGRA124_MC_RESET(DC, 0x200, 0x204, 2),
1006 TEGRA124_MC_RESET(DCB, 0x200, 0x204, 3),
1007 TEGRA124_MC_RESET(HC, 0x200, 0x204, 6),
1008 TEGRA124_MC_RESET(HDA, 0x200, 0x204, 7),
1009 TEGRA124_MC_RESET(ISP2, 0x200, 0x204, 8),
1010 TEGRA124_MC_RESET(MPCORE, 0x200, 0x204, 9),
1011 TEGRA124_MC_RESET(MPCORELP, 0x200, 0x204, 10),
1012 TEGRA124_MC_RESET(MSENC, 0x200, 0x204, 11),
1013 TEGRA124_MC_RESET(PPCS, 0x200, 0x204, 14),
1014 TEGRA124_MC_RESET(SATA, 0x200, 0x204, 15),
1015 TEGRA124_MC_RESET(VDE, 0x200, 0x204, 16),
1016 TEGRA124_MC_RESET(VI, 0x200, 0x204, 17),
1017 TEGRA124_MC_RESET(VIC, 0x200, 0x204, 18),
1018 TEGRA124_MC_RESET(XUSB_HOST, 0x200, 0x204, 19),
1019 TEGRA124_MC_RESET(XUSB_DEV, 0x200, 0x204, 20),
1020 TEGRA124_MC_RESET(TSEC, 0x200, 0x204, 21),
1021 TEGRA124_MC_RESET(SDMMC1, 0x200, 0x204, 22),
1022 TEGRA124_MC_RESET(SDMMC2, 0x200, 0x204, 23),
1023 TEGRA124_MC_RESET(SDMMC3, 0x200, 0x204, 25),
1024 TEGRA124_MC_RESET(SDMMC4, 0x970, 0x974, 0),
1025 TEGRA124_MC_RESET(ISP2B, 0x970, 0x974, 1),
1026 TEGRA124_MC_RESET(GPU, 0x970, 0x974, 2),
1029 #ifdef CONFIG_ARCH_TEGRA_124_SOC
1030 static const unsigned long tegra124_mc_emem_regs[] = {
1032 MC_EMEM_ARB_OUTSTANDING_REQ,
1033 MC_EMEM_ARB_TIMING_RCD,
1034 MC_EMEM_ARB_TIMING_RP,
1035 MC_EMEM_ARB_TIMING_RC,
1036 MC_EMEM_ARB_TIMING_RAS,
1037 MC_EMEM_ARB_TIMING_FAW,
1038 MC_EMEM_ARB_TIMING_RRD,
1039 MC_EMEM_ARB_TIMING_RAP2PRE,
1040 MC_EMEM_ARB_TIMING_WAP2PRE,
1041 MC_EMEM_ARB_TIMING_R2R,
1042 MC_EMEM_ARB_TIMING_W2W,
1043 MC_EMEM_ARB_TIMING_R2W,
1044 MC_EMEM_ARB_TIMING_W2R,
1045 MC_EMEM_ARB_DA_TURNS,
1046 MC_EMEM_ARB_DA_COVERS,
1049 MC_EMEM_ARB_RING1_THROTTLE
1052 static const struct tegra_smmu_soc tegra124_smmu_soc = {
1053 .clients = tegra124_mc_clients,
1054 .num_clients = ARRAY_SIZE(tegra124_mc_clients),
1055 .swgroups = tegra124_swgroups,
1056 .num_swgroups = ARRAY_SIZE(tegra124_swgroups),
1057 .groups = tegra124_groups,
1058 .num_groups = ARRAY_SIZE(tegra124_groups),
1059 .supports_round_robin_arbitration = true,
1060 .supports_request_limit = true,
1061 .num_tlb_lines = 32,
1065 const struct tegra_mc_soc tegra124_mc_soc = {
1066 .clients = tegra124_mc_clients,
1067 .num_clients = ARRAY_SIZE(tegra124_mc_clients),
1068 .num_address_bits = 34,
1070 .client_id_mask = 0x7f,
1071 .smmu = &tegra124_smmu_soc,
1072 .emem_regs = tegra124_mc_emem_regs,
1073 .num_emem_regs = ARRAY_SIZE(tegra124_mc_emem_regs),
1074 .intmask = MC_INT_DECERR_MTS | MC_INT_SECERR_SEC | MC_INT_DECERR_VPR |
1075 MC_INT_INVALID_APB_ASID_UPDATE | MC_INT_INVALID_SMMU_PAGE |
1076 MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM,
1077 .reset_ops = &tegra_mc_reset_ops_common,
1078 .resets = tegra124_mc_resets,
1079 .num_resets = ARRAY_SIZE(tegra124_mc_resets),
1081 #endif /* CONFIG_ARCH_TEGRA_124_SOC */
1083 #ifdef CONFIG_ARCH_TEGRA_132_SOC
1084 static const struct tegra_smmu_soc tegra132_smmu_soc = {
1085 .clients = tegra124_mc_clients,
1086 .num_clients = ARRAY_SIZE(tegra124_mc_clients),
1087 .swgroups = tegra124_swgroups,
1088 .num_swgroups = ARRAY_SIZE(tegra124_swgroups),
1089 .groups = tegra124_groups,
1090 .num_groups = ARRAY_SIZE(tegra124_groups),
1091 .supports_round_robin_arbitration = true,
1092 .supports_request_limit = true,
1093 .num_tlb_lines = 32,
1097 const struct tegra_mc_soc tegra132_mc_soc = {
1098 .clients = tegra124_mc_clients,
1099 .num_clients = ARRAY_SIZE(tegra124_mc_clients),
1100 .num_address_bits = 34,
1102 .client_id_mask = 0x7f,
1103 .smmu = &tegra132_smmu_soc,
1104 .intmask = MC_INT_DECERR_MTS | MC_INT_SECERR_SEC | MC_INT_DECERR_VPR |
1105 MC_INT_INVALID_APB_ASID_UPDATE | MC_INT_INVALID_SMMU_PAGE |
1106 MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM,
1107 .reset_ops = &tegra_mc_reset_ops_common,
1108 .resets = tegra124_mc_resets,
1109 .num_resets = ARRAY_SIZE(tegra124_mc_resets),
1111 #endif /* CONFIG_ARCH_TEGRA_132_SOC */