Skip to content

Commit 3c01cf3

Browse files
Paul Walmsleythierryreding
authored andcommitted
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 <[email protected]>. Signed-off-by: Paul Walmsley <[email protected]> Cc: Paul Walmsley <[email protected]> Cc: Thierry Reding <[email protected]> Cc: David Ung <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent 30a636f commit 3c01cf3

File tree

5 files changed

+9
-2
lines changed

5 files changed

+9
-2
lines changed

drivers/memory/tegra/mc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
#define MC_ERR_STATUS_ADR_HI_MASK 0x3
4343
#define MC_ERR_STATUS_SECURITY (1 << 17)
4444
#define MC_ERR_STATUS_RW (1 << 16)
45-
#define MC_ERR_STATUS_CLIENT_MASK 0x7f
4645

4746
#define MC_ERR_ADR 0x0c
4847

@@ -283,7 +282,7 @@ static irqreturn_t tegra_mc_irq(int irq, void *data)
283282
else
284283
secure = "";
285284

286-
id = value & MC_ERR_STATUS_CLIENT_MASK;
285+
id = value & mc->soc->client_id_mask;
287286

288287
for (i = 0; i < mc->soc->num_clients; i++) {
289288
if (mc->soc->clients[i].id == id) {
@@ -410,6 +409,8 @@ static int tegra_mc_probe(struct platform_device *pdev)
410409
return err;
411410
}
412411

412+
WARN(!mc->soc->client_id_mask, "Missing client ID mask for this SoC\n");
413+
413414
value = MC_INT_DECERR_MTS | MC_INT_SECERR_SEC | MC_INT_DECERR_VPR |
414415
MC_INT_INVALID_APB_ASID_UPDATE | MC_INT_INVALID_SMMU_PAGE |
415416
MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM;

drivers/memory/tegra/tegra114.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -944,5 +944,6 @@ const struct tegra_mc_soc tegra114_mc_soc = {
944944
.num_clients = ARRAY_SIZE(tegra114_mc_clients),
945945
.num_address_bits = 32,
946946
.atom_size = 32,
947+
.client_id_mask = 0x7f,
947948
.smmu = &tegra114_smmu_soc,
948949
};

drivers/memory/tegra/tegra124.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,7 @@ const struct tegra_mc_soc tegra124_mc_soc = {
10321032
.num_clients = ARRAY_SIZE(tegra124_mc_clients),
10331033
.num_address_bits = 34,
10341034
.atom_size = 32,
1035+
.client_id_mask = 0x7f,
10351036
.smmu = &tegra124_smmu_soc,
10361037
.emem_regs = tegra124_mc_emem_regs,
10371038
.num_emem_regs = ARRAY_SIZE(tegra124_mc_emem_regs),
@@ -1067,6 +1068,7 @@ const struct tegra_mc_soc tegra132_mc_soc = {
10671068
.num_clients = ARRAY_SIZE(tegra124_mc_clients),
10681069
.num_address_bits = 34,
10691070
.atom_size = 32,
1071+
.client_id_mask = 0x7f,
10701072
.smmu = &tegra132_smmu_soc,
10711073
};
10721074
#endif /* CONFIG_ARCH_TEGRA_132_SOC */

drivers/memory/tegra/tegra30.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,5 +966,6 @@ const struct tegra_mc_soc tegra30_mc_soc = {
966966
.num_clients = ARRAY_SIZE(tegra30_mc_clients),
967967
.num_address_bits = 32,
968968
.atom_size = 16,
969+
.client_id_mask = 0x7f,
969970
.smmu = &tegra30_smmu_soc,
970971
};

include/soc/tegra/mc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ struct tegra_mc_soc {
102102
unsigned int num_address_bits;
103103
unsigned int atom_size;
104104

105+
u8 client_id_mask;
106+
105107
const struct tegra_smmu_soc *smmu;
106108
};
107109

0 commit comments

Comments
 (0)