Skip to content

Commit 2e4cfaa

Browse files
Ketan Patilkrzk
authored andcommitted
memory: tegra: Group SoC specific fields
Introduce new SoC specific fields in tegra_mc_soc struct for high address mask and error status type mask because Tegra264 has different values for these than the existing devices. Error status registers e.g. MC_ERR_STATUS_0 has few bits which indicate the type of the error. In order to obtain such type of error from error status register, we use error status type mask. Similarly, these error status registers have bits which indicate the higher address bits of the address responsible for mc error. In order to obtain such higher address, we use high address mask. Make this change to prepare for adding MC interrupt support for Tegra264. Signed-off-by: Ketan Patil <ketanp@nvidia.com> Reviewed-by: Jon Hunter <jonathanh@nvidia.com> Tested-by: Jon Hunter <jonathanh@nvidia.com> Link: https://patch.msgid.link/20260226163115.1152181-5-ketanp@nvidia.com [krzk: Fix checkpatch warning] Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
1 parent 4d865a2 commit 2e4cfaa

11 files changed

Lines changed: 24 additions & 6 deletions

File tree

drivers/memory/tegra/mc.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -658,9 +658,12 @@ irqreturn_t tegra30_mc_handle_irq(int irq, void *data)
658658
addr = mc_ch_readl(mc, channel, addr_hi_reg);
659659
else
660660
addr = mc_readl(mc, addr_hi_reg);
661-
} else {
661+
} else if (mc->soc->mc_addr_hi_mask) {
662662
addr = ((value >> MC_ERR_STATUS_ADR_HI_SHIFT) &
663-
MC_ERR_STATUS_ADR_HI_MASK);
663+
mc->soc->mc_addr_hi_mask);
664+
} else {
665+
dev_err_ratelimited(mc->dev, "Unable to determine high address!");
666+
return IRQ_NONE;
664667
}
665668
addr <<= 32;
666669
}
@@ -685,11 +688,11 @@ irqreturn_t tegra30_mc_handle_irq(int irq, void *data)
685688
}
686689
}
687690

688-
type = (value & MC_ERR_STATUS_TYPE_MASK) >>
691+
type = (value & mc->soc->mc_err_status_type_mask) >>
689692
MC_ERR_STATUS_TYPE_SHIFT;
690693
desc = tegra_mc_error_names[type];
691694

692-
switch (value & MC_ERR_STATUS_TYPE_MASK) {
695+
switch (value & mc->soc->mc_err_status_type_mask) {
693696
case MC_ERR_STATUS_TYPE_INVALID_SMMU_PAGE:
694697
perm[0] = ' ';
695698
perm[1] = '[';

drivers/memory/tegra/mc.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,8 @@
7878

7979
#define MC_ERR_STATUS_TYPE_SHIFT 28
8080
#define MC_ERR_STATUS_TYPE_INVALID_SMMU_PAGE (0x6 << 28)
81-
#define MC_ERR_STATUS_TYPE_MASK (0x7 << 28)
8281

8382
#define MC_ERR_STATUS_ADR_HI_SHIFT 20
84-
#define MC_ERR_STATUS_ADR_HI_MASK 0x3
8583

8684
#define MC_BROADCAST_CHANNEL ~0
8785

drivers/memory/tegra/tegra114.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,4 +1117,5 @@ const struct tegra_mc_soc tegra114_mc_soc = {
11171117
.regs = &tegra20_mc_regs,
11181118
.handle_irq = tegra30_mc_irq_handlers,
11191119
.num_interrupts = ARRAY_SIZE(tegra30_mc_irq_handlers),
1120+
.mc_err_status_type_mask = (0x7 << 28),
11201121
};

drivers/memory/tegra/tegra124.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,6 +1278,8 @@ const struct tegra_mc_soc tegra124_mc_soc = {
12781278
.regs = &tegra20_mc_regs,
12791279
.handle_irq = tegra30_mc_irq_handlers,
12801280
.num_interrupts = ARRAY_SIZE(tegra30_mc_irq_handlers),
1281+
.mc_addr_hi_mask = 0x3,
1282+
.mc_err_status_type_mask = (0x7 << 28),
12811283
};
12821284
#endif /* CONFIG_ARCH_TEGRA_124_SOC */
12831285

@@ -1313,5 +1315,7 @@ const struct tegra_mc_soc tegra132_mc_soc = {
13131315
.regs = &tegra20_mc_regs,
13141316
.handle_irq = tegra30_mc_irq_handlers,
13151317
.num_interrupts = ARRAY_SIZE(tegra30_mc_irq_handlers),
1318+
.mc_addr_hi_mask = 0x3,
1319+
.mc_err_status_type_mask = (0x7 << 28),
13161320
};
13171321
#endif /* CONFIG_ARCH_TEGRA_132_SOC */

drivers/memory/tegra/tegra186.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -916,5 +916,7 @@ const struct tegra_mc_soc tegra186_mc_soc = {
916916
.regs = &tegra20_mc_regs,
917917
.handle_irq = tegra30_mc_irq_handlers,
918918
.num_interrupts = ARRAY_SIZE(tegra30_mc_irq_handlers),
919+
.mc_addr_hi_mask = 0x3,
920+
.mc_err_status_type_mask = (0x7 << 28),
919921
};
920922
#endif

drivers/memory/tegra/tegra194.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,4 +1361,6 @@ const struct tegra_mc_soc tegra194_mc_soc = {
13611361
.regs = &tegra20_mc_regs,
13621362
.handle_irq = tegra30_mc_irq_handlers,
13631363
.num_interrupts = ARRAY_SIZE(tegra30_mc_irq_handlers),
1364+
.mc_addr_hi_mask = 0x3,
1365+
.mc_err_status_type_mask = (0x7 << 28),
13641366
};

drivers/memory/tegra/tegra20.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,4 +784,5 @@ const struct tegra_mc_soc tegra20_mc_soc = {
784784
.regs = &tegra20_mc_regs,
785785
.handle_irq = tegra20_mc_irq_handlers,
786786
.num_interrupts = ARRAY_SIZE(tegra20_mc_irq_handlers),
787+
.mc_err_status_type_mask = (0x7 << 28),
787788
};

drivers/memory/tegra/tegra210.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,4 +1290,6 @@ const struct tegra_mc_soc tegra210_mc_soc = {
12901290
.regs = &tegra20_mc_regs,
12911291
.handle_irq = tegra30_mc_irq_handlers,
12921292
.num_interrupts = ARRAY_SIZE(tegra30_mc_irq_handlers),
1293+
.mc_addr_hi_mask = 0x3,
1294+
.mc_err_status_type_mask = (0x7 << 28),
12931295
};

drivers/memory/tegra/tegra234.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,4 +1155,6 @@ const struct tegra_mc_soc tegra234_mc_soc = {
11551155
.regs = &tegra20_mc_regs,
11561156
.handle_irq = tegra30_mc_irq_handlers,
11571157
.num_interrupts = ARRAY_SIZE(tegra30_mc_irq_handlers),
1158+
.mc_addr_hi_mask = 0x3,
1159+
.mc_err_status_type_mask = (0x7 << 28),
11581160
};

drivers/memory/tegra/tegra30.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,4 +1403,5 @@ const struct tegra_mc_soc tegra30_mc_soc = {
14031403
.regs = &tegra20_mc_regs,
14041404
.handle_irq = tegra30_mc_irq_handlers,
14051405
.num_interrupts = ARRAY_SIZE(tegra30_mc_irq_handlers),
1406+
.mc_err_status_type_mask = (0x7 << 28),
14061407
};

0 commit comments

Comments
 (0)