summaryrefslogtreecommitdiffstats
path: root/drivers/memory
diff options
context:
space:
mode:
authorDmitry Osipenko <digetx@gmail.com>2018-04-09 15:28:29 -0400
committerThierry Reding <treding@nvidia.com>2018-04-27 05:23:04 -0400
commit1c74d5c0de0c2cc29fef97a19251da2ad6f579bd (patch)
tree947043f811ee1f23df4060f0774228bae8add4b1 /drivers/memory
parentdb4a9c1935760c86f2d0a3612c2f6c658c5bb031 (diff)
memory: tegra: Apply interrupts mask per SoC
Currently we are enabling handling of interrupts specific to Tegra124+ which happen to overlap with previous generations. Let's specify interrupts mask per SoC generation for consistency and in a preparation of squashing of Tegra20 driver into the common one that will enable handling of GART faults which may be undesirable by newer generations. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/memory')
-rw-r--r--drivers/memory/tegra/mc.c21
-rw-r--r--drivers/memory/tegra/mc.h9
-rw-r--r--drivers/memory/tegra/tegra114.c2
-rw-r--r--drivers/memory/tegra/tegra124.c6
-rw-r--r--drivers/memory/tegra/tegra210.c3
-rw-r--r--drivers/memory/tegra/tegra30.c2
6 files changed, 25 insertions, 18 deletions
diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c
index e55b9733bd83..60509f0a386b 100644
--- a/drivers/memory/tegra/mc.c
+++ b/drivers/memory/tegra/mc.c
@@ -20,14 +20,6 @@
20#include "mc.h" 20#include "mc.h"
21 21
22#define MC_INTSTATUS 0x000 22#define MC_INTSTATUS 0x000
23#define MC_INT_DECERR_MTS (1 << 16)
24#define MC_INT_SECERR_SEC (1 << 13)
25#define MC_INT_DECERR_VPR (1 << 12)
26#define MC_INT_INVALID_APB_ASID_UPDATE (1 << 11)
27#define MC_INT_INVALID_SMMU_PAGE (1 << 10)
28#define MC_INT_ARBITRATION_EMEM (1 << 9)
29#define MC_INT_SECURITY_VIOLATION (1 << 8)
30#define MC_INT_DECERR_EMEM (1 << 6)
31 23
32#define MC_INTMASK 0x004 24#define MC_INTMASK 0x004
33 25
@@ -248,13 +240,11 @@ static const char *const error_names[8] = {
248static irqreturn_t tegra_mc_irq(int irq, void *data) 240static irqreturn_t tegra_mc_irq(int irq, void *data)
249{ 241{
250 struct tegra_mc *mc = data; 242 struct tegra_mc *mc = data;
251 unsigned long status, mask; 243 unsigned long status;
252 unsigned int bit; 244 unsigned int bit;
253 245
254 /* mask all interrupts to avoid flooding */ 246 /* mask all interrupts to avoid flooding */
255 mask = mc_readl(mc, MC_INTMASK); 247 status = mc_readl(mc, MC_INTSTATUS) & mc->soc->intmask;
256 status = mc_readl(mc, MC_INTSTATUS) & mask;
257
258 if (!status) 248 if (!status)
259 return IRQ_NONE; 249 return IRQ_NONE;
260 250
@@ -349,7 +339,6 @@ static int tegra_mc_probe(struct platform_device *pdev)
349 const struct of_device_id *match; 339 const struct of_device_id *match;
350 struct resource *res; 340 struct resource *res;
351 struct tegra_mc *mc; 341 struct tegra_mc *mc;
352 u32 value;
353 int err; 342 int err;
354 343
355 match = of_match_node(tegra_mc_of_match, pdev->dev.of_node); 344 match = of_match_node(tegra_mc_of_match, pdev->dev.of_node);
@@ -409,11 +398,7 @@ static int tegra_mc_probe(struct platform_device *pdev)
409 398
410 WARN(!mc->soc->client_id_mask, "Missing client ID mask for this SoC\n"); 399 WARN(!mc->soc->client_id_mask, "Missing client ID mask for this SoC\n");
411 400
412 value = MC_INT_DECERR_MTS | MC_INT_SECERR_SEC | MC_INT_DECERR_VPR | 401 mc_writel(mc, mc->soc->intmask, MC_INTMASK);
413 MC_INT_INVALID_APB_ASID_UPDATE | MC_INT_INVALID_SMMU_PAGE |
414 MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM;
415
416 mc_writel(mc, value, MC_INTMASK);
417 402
418 err = devm_request_irq(&pdev->dev, mc->irq, tegra_mc_irq, IRQF_SHARED, 403 err = devm_request_irq(&pdev->dev, mc->irq, tegra_mc_irq, IRQF_SHARED,
419 dev_name(&pdev->dev), mc); 404 dev_name(&pdev->dev), mc);
diff --git a/drivers/memory/tegra/mc.h b/drivers/memory/tegra/mc.h
index ddb16676c3af..24e020b4609b 100644
--- a/drivers/memory/tegra/mc.h
+++ b/drivers/memory/tegra/mc.h
@@ -14,6 +14,15 @@
14 14
15#include <soc/tegra/mc.h> 15#include <soc/tegra/mc.h>
16 16
17#define MC_INT_DECERR_MTS (1 << 16)
18#define MC_INT_SECERR_SEC (1 << 13)
19#define MC_INT_DECERR_VPR (1 << 12)
20#define MC_INT_INVALID_APB_ASID_UPDATE (1 << 11)
21#define MC_INT_INVALID_SMMU_PAGE (1 << 10)
22#define MC_INT_ARBITRATION_EMEM (1 << 9)
23#define MC_INT_SECURITY_VIOLATION (1 << 8)
24#define MC_INT_DECERR_EMEM (1 << 6)
25
17static inline u32 mc_readl(struct tegra_mc *mc, unsigned long offset) 26static inline u32 mc_readl(struct tegra_mc *mc, unsigned long offset)
18{ 27{
19 return readl(mc->regs + offset); 28 return readl(mc->regs + offset);
diff --git a/drivers/memory/tegra/tegra114.c b/drivers/memory/tegra/tegra114.c
index b20e6e3e208e..7560b2f558a7 100644
--- a/drivers/memory/tegra/tegra114.c
+++ b/drivers/memory/tegra/tegra114.c
@@ -945,4 +945,6 @@ const struct tegra_mc_soc tegra114_mc_soc = {
945 .atom_size = 32, 945 .atom_size = 32,
946 .client_id_mask = 0x7f, 946 .client_id_mask = 0x7f,
947 .smmu = &tegra114_smmu_soc, 947 .smmu = &tegra114_smmu_soc,
948 .intmask = MC_INT_INVALID_SMMU_PAGE | MC_INT_SECURITY_VIOLATION |
949 MC_INT_DECERR_EMEM,
948}; 950};
diff --git a/drivers/memory/tegra/tegra124.c b/drivers/memory/tegra/tegra124.c
index 8b6360eabb8a..bd16555cca0f 100644
--- a/drivers/memory/tegra/tegra124.c
+++ b/drivers/memory/tegra/tegra124.c
@@ -1035,6 +1035,9 @@ const struct tegra_mc_soc tegra124_mc_soc = {
1035 .smmu = &tegra124_smmu_soc, 1035 .smmu = &tegra124_smmu_soc,
1036 .emem_regs = tegra124_mc_emem_regs, 1036 .emem_regs = tegra124_mc_emem_regs,
1037 .num_emem_regs = ARRAY_SIZE(tegra124_mc_emem_regs), 1037 .num_emem_regs = ARRAY_SIZE(tegra124_mc_emem_regs),
1038 .intmask = MC_INT_DECERR_MTS | MC_INT_SECERR_SEC | MC_INT_DECERR_VPR |
1039 MC_INT_INVALID_APB_ASID_UPDATE | MC_INT_INVALID_SMMU_PAGE |
1040 MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM,
1038}; 1041};
1039#endif /* CONFIG_ARCH_TEGRA_124_SOC */ 1042#endif /* CONFIG_ARCH_TEGRA_124_SOC */
1040 1043
@@ -1059,5 +1062,8 @@ const struct tegra_mc_soc tegra132_mc_soc = {
1059 .atom_size = 32, 1062 .atom_size = 32,
1060 .client_id_mask = 0x7f, 1063 .client_id_mask = 0x7f,
1061 .smmu = &tegra132_smmu_soc, 1064 .smmu = &tegra132_smmu_soc,
1065 .intmask = MC_INT_DECERR_MTS | MC_INT_SECERR_SEC | MC_INT_DECERR_VPR |
1066 MC_INT_INVALID_APB_ASID_UPDATE | MC_INT_INVALID_SMMU_PAGE |
1067 MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM,
1062}; 1068};
1063#endif /* CONFIG_ARCH_TEGRA_132_SOC */ 1069#endif /* CONFIG_ARCH_TEGRA_132_SOC */
diff --git a/drivers/memory/tegra/tegra210.c b/drivers/memory/tegra/tegra210.c
index d398bcd3fc57..3b8d0100088c 100644
--- a/drivers/memory/tegra/tegra210.c
+++ b/drivers/memory/tegra/tegra210.c
@@ -1092,4 +1092,7 @@ const struct tegra_mc_soc tegra210_mc_soc = {
1092 .atom_size = 64, 1092 .atom_size = 64,
1093 .client_id_mask = 0xff, 1093 .client_id_mask = 0xff,
1094 .smmu = &tegra210_smmu_soc, 1094 .smmu = &tegra210_smmu_soc,
1095 .intmask = MC_INT_DECERR_MTS | MC_INT_SECERR_SEC | MC_INT_DECERR_VPR |
1096 MC_INT_INVALID_APB_ASID_UPDATE | MC_INT_INVALID_SMMU_PAGE |
1097 MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM,
1095}; 1098};
diff --git a/drivers/memory/tegra/tegra30.c b/drivers/memory/tegra/tegra30.c
index d756c837f23e..d2ba50ed0490 100644
--- a/drivers/memory/tegra/tegra30.c
+++ b/drivers/memory/tegra/tegra30.c
@@ -967,4 +967,6 @@ const struct tegra_mc_soc tegra30_mc_soc = {
967 .atom_size = 16, 967 .atom_size = 16,
968 .client_id_mask = 0x7f, 968 .client_id_mask = 0x7f,
969 .smmu = &tegra30_smmu_soc, 969 .smmu = &tegra30_smmu_soc,
970 .intmask = MC_INT_INVALID_SMMU_PAGE | MC_INT_SECURITY_VIOLATION |
971 MC_INT_DECERR_EMEM,
970}; 972};