diff options
author | Paul Walmsley <paul@pwsan.com> | 2015-06-04 15:33:48 -0400 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2015-08-13 10:07:52 -0400 |
commit | 3c01cf3befa66cc21f06672685cf59a53056887a (patch) | |
tree | 0dc2664bc3b5851928b2e4eef74e9214820015e7 | |
parent | 30a636f984984655ad5350e73a6a3141c9ba85ae (diff) |
memory: tegra: Add support for a variable-size client ID bitfield
Recent versions of the Tegra MC hardware extend the size of the client
ID bitfield in the MC_ERR_STATUS register by one bit. While one could
simply extend the bitfield for older hardware, that would allow data
from reserved bits into the driver code, which is generally a bad idea
on principle. So this patch instead passes in the client ID mask from
from the per-SoC MC data.
There's no MC support for T210 (yet), but when that support winds up
in the kernel, the appropriate soc->client_id_mask value for that chip
will be 0xff.
Based on an original patch by David Ung <davidu@nvidia.com>.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Paul Walmsley <pwalmsley@nvidia.com>
Cc: Thierry Reding <treding@nvidia.com>
Cc: David Ung <davidu@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r-- | drivers/memory/tegra/mc.c | 5 | ||||
-rw-r--r-- | drivers/memory/tegra/tegra114.c | 1 | ||||
-rw-r--r-- | drivers/memory/tegra/tegra124.c | 2 | ||||
-rw-r--r-- | drivers/memory/tegra/tegra30.c | 1 | ||||
-rw-r--r-- | include/soc/tegra/mc.h | 2 |
5 files changed, 9 insertions, 2 deletions
diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c index c71ede67e6c8..5d10c9285f34 100644 --- a/drivers/memory/tegra/mc.c +++ b/drivers/memory/tegra/mc.c | |||
@@ -42,7 +42,6 @@ | |||
42 | #define MC_ERR_STATUS_ADR_HI_MASK 0x3 | 42 | #define MC_ERR_STATUS_ADR_HI_MASK 0x3 |
43 | #define MC_ERR_STATUS_SECURITY (1 << 17) | 43 | #define MC_ERR_STATUS_SECURITY (1 << 17) |
44 | #define MC_ERR_STATUS_RW (1 << 16) | 44 | #define MC_ERR_STATUS_RW (1 << 16) |
45 | #define MC_ERR_STATUS_CLIENT_MASK 0x7f | ||
46 | 45 | ||
47 | #define MC_ERR_ADR 0x0c | 46 | #define MC_ERR_ADR 0x0c |
48 | 47 | ||
@@ -283,7 +282,7 @@ static irqreturn_t tegra_mc_irq(int irq, void *data) | |||
283 | else | 282 | else |
284 | secure = ""; | 283 | secure = ""; |
285 | 284 | ||
286 | id = value & MC_ERR_STATUS_CLIENT_MASK; | 285 | id = value & mc->soc->client_id_mask; |
287 | 286 | ||
288 | for (i = 0; i < mc->soc->num_clients; i++) { | 287 | for (i = 0; i < mc->soc->num_clients; i++) { |
289 | if (mc->soc->clients[i].id == id) { | 288 | if (mc->soc->clients[i].id == id) { |
@@ -410,6 +409,8 @@ static int tegra_mc_probe(struct platform_device *pdev) | |||
410 | return err; | 409 | return err; |
411 | } | 410 | } |
412 | 411 | ||
412 | WARN(!mc->soc->client_id_mask, "Missing client ID mask for this SoC\n"); | ||
413 | |||
413 | value = MC_INT_DECERR_MTS | MC_INT_SECERR_SEC | MC_INT_DECERR_VPR | | 414 | value = MC_INT_DECERR_MTS | MC_INT_SECERR_SEC | MC_INT_DECERR_VPR | |
414 | MC_INT_INVALID_APB_ASID_UPDATE | MC_INT_INVALID_SMMU_PAGE | | 415 | MC_INT_INVALID_APB_ASID_UPDATE | MC_INT_INVALID_SMMU_PAGE | |
415 | MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM; | 416 | MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM; |
diff --git a/drivers/memory/tegra/tegra114.c b/drivers/memory/tegra/tegra114.c index 9f579589e800..c8765db07a62 100644 --- a/drivers/memory/tegra/tegra114.c +++ b/drivers/memory/tegra/tegra114.c | |||
@@ -944,5 +944,6 @@ const struct tegra_mc_soc tegra114_mc_soc = { | |||
944 | .num_clients = ARRAY_SIZE(tegra114_mc_clients), | 944 | .num_clients = ARRAY_SIZE(tegra114_mc_clients), |
945 | .num_address_bits = 32, | 945 | .num_address_bits = 32, |
946 | .atom_size = 32, | 946 | .atom_size = 32, |
947 | .client_id_mask = 0x7f, | ||
947 | .smmu = &tegra114_smmu_soc, | 948 | .smmu = &tegra114_smmu_soc, |
948 | }; | 949 | }; |
diff --git a/drivers/memory/tegra/tegra124.c b/drivers/memory/tegra/tegra124.c index 966e1557e6f4..060fb3d7a23f 100644 --- a/drivers/memory/tegra/tegra124.c +++ b/drivers/memory/tegra/tegra124.c | |||
@@ -1032,6 +1032,7 @@ const struct tegra_mc_soc tegra124_mc_soc = { | |||
1032 | .num_clients = ARRAY_SIZE(tegra124_mc_clients), | 1032 | .num_clients = ARRAY_SIZE(tegra124_mc_clients), |
1033 | .num_address_bits = 34, | 1033 | .num_address_bits = 34, |
1034 | .atom_size = 32, | 1034 | .atom_size = 32, |
1035 | .client_id_mask = 0x7f, | ||
1035 | .smmu = &tegra124_smmu_soc, | 1036 | .smmu = &tegra124_smmu_soc, |
1036 | .emem_regs = tegra124_mc_emem_regs, | 1037 | .emem_regs = tegra124_mc_emem_regs, |
1037 | .num_emem_regs = ARRAY_SIZE(tegra124_mc_emem_regs), | 1038 | .num_emem_regs = ARRAY_SIZE(tegra124_mc_emem_regs), |
@@ -1067,6 +1068,7 @@ const struct tegra_mc_soc tegra132_mc_soc = { | |||
1067 | .num_clients = ARRAY_SIZE(tegra124_mc_clients), | 1068 | .num_clients = ARRAY_SIZE(tegra124_mc_clients), |
1068 | .num_address_bits = 34, | 1069 | .num_address_bits = 34, |
1069 | .atom_size = 32, | 1070 | .atom_size = 32, |
1071 | .client_id_mask = 0x7f, | ||
1070 | .smmu = &tegra132_smmu_soc, | 1072 | .smmu = &tegra132_smmu_soc, |
1071 | }; | 1073 | }; |
1072 | #endif /* CONFIG_ARCH_TEGRA_132_SOC */ | 1074 | #endif /* CONFIG_ARCH_TEGRA_132_SOC */ |
diff --git a/drivers/memory/tegra/tegra30.c b/drivers/memory/tegra/tegra30.c index 1abcd8f6f3ba..52e16c7b34f8 100644 --- a/drivers/memory/tegra/tegra30.c +++ b/drivers/memory/tegra/tegra30.c | |||
@@ -966,5 +966,6 @@ const struct tegra_mc_soc tegra30_mc_soc = { | |||
966 | .num_clients = ARRAY_SIZE(tegra30_mc_clients), | 966 | .num_clients = ARRAY_SIZE(tegra30_mc_clients), |
967 | .num_address_bits = 32, | 967 | .num_address_bits = 32, |
968 | .atom_size = 16, | 968 | .atom_size = 16, |
969 | .client_id_mask = 0x7f, | ||
969 | .smmu = &tegra30_smmu_soc, | 970 | .smmu = &tegra30_smmu_soc, |
970 | }; | 971 | }; |
diff --git a/include/soc/tegra/mc.h b/include/soc/tegra/mc.h index 1ab2813273cd..370f2909ec19 100644 --- a/include/soc/tegra/mc.h +++ b/include/soc/tegra/mc.h | |||
@@ -102,6 +102,8 @@ struct tegra_mc_soc { | |||
102 | unsigned int num_address_bits; | 102 | unsigned int num_address_bits; |
103 | unsigned int atom_size; | 103 | unsigned int atom_size; |
104 | 104 | ||
105 | u8 client_id_mask; | ||
106 | |||
105 | const struct tegra_smmu_soc *smmu; | 107 | const struct tegra_smmu_soc *smmu; |
106 | }; | 108 | }; |
107 | 109 | ||