[PATCH 1/3] memory: tegra: Use named defines for Tegra264 MC apertures

From: Ketan Patil

Date: Thu Sep 03 2026 - 15:11:52 EST


The Tegra264 memory controller error interrupts are distributed across
several HUB/HUBC apertures, each accessed like a broadcast channel using
a fixed index. These indices were kept in a bare mc_hubc_aperture_number[]
array, and handle_hub_irq() took a parameter of the same name that
shadowed it.

This driver is only applicable to Tegra264 devices and so this
abstraction is not needed. Replace the array with named
TEGRA264_MC_APERTURE_* defines to simplify the code.

No functional change intended.

Signed-off-by: Ketan Patil <ketanp@xxxxxxxxxx>
---
drivers/memory/tegra/tegra264.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/memory/tegra/tegra264.c b/drivers/memory/tegra/tegra264.c
index 790349295dcc..56e55269eed7 100644
--- a/drivers/memory/tegra/tegra264.c
+++ b/drivers/memory/tegra/tegra264.c
@@ -717,11 +717,15 @@ static const char *const tegra264_rt_error_names[16] = {
};

/*
- * MC instance aperture mapping for hubc registers
+ * On Tegra264 the memory controller error interrupts are distributed across
+ * several HUB/HUBC apertures. Each aperture is accessed like a broadcast
+ * channel through mc_ch_readl()/mc_ch_writel() using its fixed index.
*/
-static const int mc_hubc_aperture_number[5] = {
- 7, 8, 9, 10, 11
-};
+#define TEGRA264_MC_APERTURE_DISP 7
+#define TEGRA264_MC_APERTURE_SYSTEM 8
+#define TEGRA264_MC_APERTURE_VISION 9
+#define TEGRA264_MC_APERTURE_UPHY 10
+#define TEGRA264_MC_APERTURE_TOP 11

/*
* tegra264_mc_icc_set() - Pass MC client info to the BPMP-FW
@@ -1057,27 +1061,27 @@ static irqreturn_t handle_hub_irq(int irq, void *data, int mc_hubc_aperture_numb

static irqreturn_t handle_disp_hub_irq(int irq, void *data)
{
- return handle_hub_irq(irq, data, mc_hubc_aperture_number[0]);
+ return handle_hub_irq(irq, data, TEGRA264_MC_APERTURE_DISP);
}

static irqreturn_t handle_system_hub_irq(int irq, void *data)
{
- return handle_hub_irq(irq, data, mc_hubc_aperture_number[1]);
+ return handle_hub_irq(irq, data, TEGRA264_MC_APERTURE_SYSTEM);
}

static irqreturn_t handle_vision_hub_irq(int irq, void *data)
{
- return handle_hub_irq(irq, data, mc_hubc_aperture_number[2]);
+ return handle_hub_irq(irq, data, TEGRA264_MC_APERTURE_VISION);
}

static irqreturn_t handle_uphy_hub_irq(int irq, void *data)
{
- return handle_hub_irq(irq, data, mc_hubc_aperture_number[3]);
+ return handle_hub_irq(irq, data, TEGRA264_MC_APERTURE_UPHY);
}

static irqreturn_t handle_top_hub_irq(int irq, void *data)
{
- return handle_hub_irq(irq, data, mc_hubc_aperture_number[4]);
+ return handle_hub_irq(irq, data, TEGRA264_MC_APERTURE_TOP);
}

static irqreturn_t handle_generic_irq(struct tegra_mc *mc, unsigned long intstat_reg)
--
2.43.0