Skip to content

Commit 2401dc4

Browse files
Sumit Guptathierryreding
authored andcommitted
memory: tegra: Add Tegra264 MC and EMC support
Add support to enable Memory Controller (MC) and External Memory Controller (EMC) drivers for Tegra264. The nodes for MC and EMC are mostly the same as Tegra234 but differ in number of channels and interrupt numbers. The patch also adds the bandwidth manager definitions required for Tegra264 and uses them to populate the memory client table. All of these are needed to properly enable memory interconnect (ICC) support. Signed-off-by: Sumit Gupta <[email protected]> Acked-by: Krzysztof Kozlowski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Thierry Reding <[email protected]>
1 parent 1f7bc0e commit 2401dc4

File tree

7 files changed

+395
-6
lines changed

7 files changed

+395
-6
lines changed

drivers/memory/tegra/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ tegra-mc-$(CONFIG_ARCH_TEGRA_210_SOC) += tegra210.o
1010
tegra-mc-$(CONFIG_ARCH_TEGRA_186_SOC) += tegra186.o
1111
tegra-mc-$(CONFIG_ARCH_TEGRA_194_SOC) += tegra186.o tegra194.o
1212
tegra-mc-$(CONFIG_ARCH_TEGRA_234_SOC) += tegra186.o tegra234.o
13+
tegra-mc-$(CONFIG_ARCH_TEGRA_264_SOC) += tegra186.o tegra264.o
1314

1415
obj-$(CONFIG_TEGRA_MC) += tegra-mc.o
1516

@@ -21,5 +22,6 @@ obj-$(CONFIG_TEGRA210_EMC) += tegra210-emc.o
2122
obj-$(CONFIG_ARCH_TEGRA_186_SOC) += tegra186-emc.o
2223
obj-$(CONFIG_ARCH_TEGRA_194_SOC) += tegra186-emc.o
2324
obj-$(CONFIG_ARCH_TEGRA_234_SOC) += tegra186-emc.o
25+
obj-$(CONFIG_ARCH_TEGRA_264_SOC) += tegra186-emc.o
2426

2527
tegra210-emc-y := tegra210-emc-core.o tegra210-emc-cc-r21021.o

drivers/memory/tegra/mc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0-only
22
/*
3-
* Copyright (C) 2014 NVIDIA CORPORATION. All rights reserved.
3+
* Copyright (C) 2014-2025 NVIDIA CORPORATION. All rights reserved.
44
*/
55

66
#include <linux/clk.h>
@@ -48,6 +48,9 @@ static const struct of_device_id tegra_mc_of_match[] = {
4848
#endif
4949
#ifdef CONFIG_ARCH_TEGRA_234_SOC
5050
{ .compatible = "nvidia,tegra234-mc", .data = &tegra234_mc_soc },
51+
#endif
52+
#ifdef CONFIG_ARCH_TEGRA_264_SOC
53+
{ .compatible = "nvidia,tegra264-mc", .data = &tegra264_mc_soc },
5154
#endif
5255
{ /* sentinel */ }
5356
};

drivers/memory/tegra/mc.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* SPDX-License-Identifier: GPL-2.0-only */
22
/*
3-
* Copyright (C) 2014 NVIDIA CORPORATION. All rights reserved.
3+
* Copyright (C) 2014-2025 NVIDIA CORPORATION. All rights reserved.
44
*/
55

66
#ifndef MEMORY_TEGRA_MC_H
@@ -182,6 +182,10 @@ extern const struct tegra_mc_soc tegra194_mc_soc;
182182
extern const struct tegra_mc_soc tegra234_mc_soc;
183183
#endif
184184

185+
#ifdef CONFIG_ARCH_TEGRA_264_SOC
186+
extern const struct tegra_mc_soc tegra264_mc_soc;
187+
#endif
188+
185189
#if defined(CONFIG_ARCH_TEGRA_3x_SOC) || \
186190
defined(CONFIG_ARCH_TEGRA_114_SOC) || \
187191
defined(CONFIG_ARCH_TEGRA_124_SOC) || \
@@ -193,7 +197,8 @@ extern const struct tegra_mc_ops tegra30_mc_ops;
193197

194198
#if defined(CONFIG_ARCH_TEGRA_186_SOC) || \
195199
defined(CONFIG_ARCH_TEGRA_194_SOC) || \
196-
defined(CONFIG_ARCH_TEGRA_234_SOC)
200+
defined(CONFIG_ARCH_TEGRA_234_SOC) || \
201+
defined(CONFIG_ARCH_TEGRA_264_SOC)
197202
extern const struct tegra_mc_ops tegra186_mc_ops;
198203
#endif
199204

drivers/memory/tegra/tegra186-emc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0-only
22
/*
3-
* Copyright (C) 2019 NVIDIA CORPORATION. All rights reserved.
3+
* Copyright (C) 2019-2025 NVIDIA CORPORATION. All rights reserved.
44
*/
55

66
#include <linux/clk.h>
@@ -393,6 +393,9 @@ static const struct of_device_id tegra186_emc_of_match[] = {
393393
#endif
394394
#if defined(CONFIG_ARCH_TEGRA_234_SOC)
395395
{ .compatible = "nvidia,tegra234-emc" },
396+
#endif
397+
#if defined(CONFIG_ARCH_TEGRA_264_SOC)
398+
{ .compatible = "nvidia,tegra264-emc" },
396399
#endif
397400
{ /* sentinel */ }
398401
};

drivers/memory/tegra/tegra186.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0-only
22
/*
3-
* Copyright (C) 2017-2021 NVIDIA CORPORATION. All rights reserved.
3+
* Copyright (C) 2017-2025 NVIDIA CORPORATION. All rights reserved.
44
*/
55

66
#include <linux/io.h>
@@ -26,11 +26,24 @@
2626
static int tegra186_mc_probe(struct tegra_mc *mc)
2727
{
2828
struct platform_device *pdev = to_platform_device(mc->dev);
29+
struct resource *res;
2930
unsigned int i;
3031
char name[8];
3132
int err;
3233

33-
mc->bcast_ch_regs = devm_platform_ioremap_resource_byname(pdev, "broadcast");
34+
/*
35+
* From Tegra264, the SID region is not present in MC node and BROADCAST is first.
36+
* The common function 'tegra_mc_probe()' already maps first region entry from DT.
37+
* Check if the SID region is present in DT then map BROADCAST. Otherwise, consider
38+
* the first entry mapped in mc probe as the BROADCAST region. This is done to avoid
39+
* mapping the region twice when SID is not present and keep backward compatibility.
40+
*/
41+
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sid");
42+
if (res)
43+
mc->bcast_ch_regs = devm_platform_ioremap_resource_byname(pdev, "broadcast");
44+
else
45+
mc->bcast_ch_regs = mc->regs;
46+
3447
if (IS_ERR(mc->bcast_ch_regs)) {
3548
if (PTR_ERR(mc->bcast_ch_regs) == -EINVAL) {
3649
dev_warn(&pdev->dev,

drivers/memory/tegra/tegra264-bwmgr.h

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
/* Copyright (C) 2025 NVIDIA CORPORATION. All rights reserved. */
3+
4+
#ifndef MEMORY_TEGRA_TEGRA264_BWMGR_H
5+
#define MEMORY_TEGRA_TEGRA264_BWMGR_H
6+
7+
#define TEGRA264_BWMGR_ICC_PRIMARY 1
8+
#define TEGRA264_BWMGR_DEBUG 2
9+
#define TEGRA264_BWMGR_CPU_CLUSTER0 3
10+
#define TEGRA264_BWMGR_CPU_CLUSTER1 4
11+
#define TEGRA264_BWMGR_CPU_CLUSTER2 5
12+
#define TEGRA264_BWMGR_CPU_CLUSTER3 6
13+
#define TEGRA264_BWMGR_CPU_CLUSTER4 7
14+
#define TEGRA264_BWMGR_CPU_CLUSTER5 8
15+
#define TEGRA264_BWMGR_CPU_CLUSTER6 9
16+
#define TEGRA264_BWMGR_CACTMON 10
17+
#define TEGRA264_BWMGR_DISPLAY 11
18+
#define TEGRA264_BWMGR_VI 12
19+
#define TEGRA264_BWMGR_APE 13
20+
#define TEGRA264_BWMGR_VIFAL 14
21+
#define TEGRA264_BWMGR_GPU 15
22+
#define TEGRA264_BWMGR_EQOS 16
23+
#define TEGRA264_BWMGR_PCIE_0 17
24+
#define TEGRA264_BWMGR_PCIE_1 18
25+
#define TEGRA264_BWMGR_PCIE_2 19
26+
#define TEGRA264_BWMGR_PCIE_3 20
27+
#define TEGRA264_BWMGR_PCIE_4 21
28+
#define TEGRA264_BWMGR_PCIE_5 22
29+
#define TEGRA264_BWMGR_SDMMC_1 23
30+
#define TEGRA264_BWMGR_SDMMC_2 24
31+
#define TEGRA264_BWMGR_NVDEC 25
32+
#define TEGRA264_BWMGR_NVENC 26
33+
#define TEGRA264_BWMGR_NVJPG_0 27
34+
#define TEGRA264_BWMGR_NVJPG_1 28
35+
#define TEGRA264_BWMGR_OFAA 29
36+
#define TEGRA264_BWMGR_XUSB_HOST 30
37+
#define TEGRA264_BWMGR_XUSB_DEV 31
38+
#define TEGRA264_BWMGR_TSEC 32
39+
#define TEGRA264_BWMGR_VIC 33
40+
#define TEGRA264_BWMGR_APEDMA 34
41+
#define TEGRA264_BWMGR_SE 35
42+
#define TEGRA264_BWMGR_ISP 36
43+
#define TEGRA264_BWMGR_HDA 37
44+
#define TEGRA264_BWMGR_VI2FAL 38
45+
#define TEGRA264_BWMGR_VI2 39
46+
#define TEGRA264_BWMGR_RCE 40
47+
#define TEGRA264_BWMGR_PVA 41
48+
#define TEGRA264_BWMGR_NVPMODEL 42
49+
50+
#endif

0 commit comments

Comments
 (0)