Skip to content

Commit 21815b9

Browse files
committed
Merge tag 'tegra-for-4.3-memory' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux into next/drivers
ARM: tegra: Memory controller updates for v4.3-rc1 Adds support for Tegra210, which allows the SMMU to be used on this new SoC generation. * tag 'tegra-for-4.3-memory' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux: memory: tegra: Add Tegra210 support memory: tegra: Add support for a variable-size client ID bitfield memory: tegra: Expose supported rates via debugfs Signed-off-by: Olof Johansson <[email protected]>
2 parents 420f262 + 588c43a commit 21815b9

File tree

11 files changed

+1174
-5
lines changed

11 files changed

+1174
-5
lines changed

drivers/iommu/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ config TEGRA_IOMMU_SMMU
222222
select IOMMU_API
223223
help
224224
This driver supports the IOMMU hardware (SMMU) found on NVIDIA Tegra
225-
SoCs (Tegra30 up to Tegra132).
225+
SoCs (Tegra30 up to Tegra210).
226226

227227
config EXYNOS_IOMMU
228228
bool "Exynos IOMMU Support"

drivers/memory/tegra/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ tegra-mc-$(CONFIG_ARCH_TEGRA_3x_SOC) += tegra30.o
44
tegra-mc-$(CONFIG_ARCH_TEGRA_114_SOC) += tegra114.o
55
tegra-mc-$(CONFIG_ARCH_TEGRA_124_SOC) += tegra124.o
66
tegra-mc-$(CONFIG_ARCH_TEGRA_132_SOC) += tegra124.o
7+
tegra-mc-$(CONFIG_ARCH_TEGRA_210_SOC) += tegra210.o
78

89
obj-$(CONFIG_TEGRA_MC) += tegra-mc.o
910

drivers/memory/tegra/mc.c

Lines changed: 6 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

@@ -66,6 +65,9 @@ static const struct of_device_id tegra_mc_of_match[] = {
6665
#endif
6766
#ifdef CONFIG_ARCH_TEGRA_132_SOC
6867
{ .compatible = "nvidia,tegra132-mc", .data = &tegra132_mc_soc },
68+
#endif
69+
#ifdef CONFIG_ARCH_TEGRA_210_SOC
70+
{ .compatible = "nvidia,tegra210-mc", .data = &tegra210_mc_soc },
6971
#endif
7072
{ }
7173
};
@@ -283,7 +285,7 @@ static irqreturn_t tegra_mc_irq(int irq, void *data)
283285
else
284286
secure = "";
285287

286-
id = value & MC_ERR_STATUS_CLIENT_MASK;
288+
id = value & mc->soc->client_id_mask;
287289

288290
for (i = 0; i < mc->soc->num_clients; i++) {
289291
if (mc->soc->clients[i].id == id) {
@@ -410,6 +412,8 @@ static int tegra_mc_probe(struct platform_device *pdev)
410412
return err;
411413
}
412414

415+
WARN(!mc->soc->client_id_mask, "Missing client ID mask for this SoC\n");
416+
413417
value = MC_INT_DECERR_MTS | MC_INT_SECERR_SEC | MC_INT_DECERR_VPR |
414418
MC_INT_INVALID_APB_ASID_UPDATE | MC_INT_INVALID_SMMU_PAGE |
415419
MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM;

drivers/memory/tegra/mc.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,8 @@ extern const struct tegra_mc_soc tegra124_mc_soc;
4141
extern const struct tegra_mc_soc tegra132_mc_soc;
4242
#endif
4343

44+
#ifdef CONFIG_ARCH_TEGRA_210_SOC
45+
extern const struct tegra_mc_soc tegra210_mc_soc;
46+
#endif
47+
4448
#endif /* MEMORY_TEGRA_MC_H */

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-emc.c

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,40 @@ static int emc_debug_rate_set(void *data, u64 rate)
10271027
DEFINE_SIMPLE_ATTRIBUTE(emc_debug_rate_fops, emc_debug_rate_get,
10281028
emc_debug_rate_set, "%lld\n");
10291029

1030-
static void emc_debugfs_init(struct device *dev)
1030+
static int emc_debug_supported_rates_show(struct seq_file *s, void *data)
1031+
{
1032+
struct tegra_emc *emc = s->private;
1033+
const char *prefix = "";
1034+
unsigned int i;
1035+
1036+
for (i = 0; i < emc->num_timings; i++) {
1037+
struct emc_timing *timing = &emc->timings[i];
1038+
1039+
seq_printf(s, "%s%lu", prefix, timing->rate);
1040+
1041+
prefix = " ";
1042+
}
1043+
1044+
seq_puts(s, "\n");
1045+
1046+
return 0;
1047+
}
1048+
1049+
static int emc_debug_supported_rates_open(struct inode *inode,
1050+
struct file *file)
1051+
{
1052+
return single_open(file, emc_debug_supported_rates_show,
1053+
inode->i_private);
1054+
}
1055+
1056+
static const struct file_operations emc_debug_supported_rates_fops = {
1057+
.open = emc_debug_supported_rates_open,
1058+
.read = seq_read,
1059+
.llseek = seq_lseek,
1060+
.release = single_release,
1061+
};
1062+
1063+
static void emc_debugfs_init(struct device *dev, struct tegra_emc *emc)
10311064
{
10321065
struct dentry *root, *file;
10331066
struct clk *clk;
@@ -1048,6 +1081,11 @@ static void emc_debugfs_init(struct device *dev)
10481081
&emc_debug_rate_fops);
10491082
if (!file)
10501083
dev_err(dev, "failed to create debugfs entry\n");
1084+
1085+
file = debugfs_create_file("supported_rates", S_IRUGO, root, emc,
1086+
&emc_debug_supported_rates_fops);
1087+
if (!file)
1088+
dev_err(dev, "failed to create debugfs entry\n");
10511089
}
10521090

10531091
static int tegra_emc_probe(struct platform_device *pdev)
@@ -1119,7 +1157,7 @@ static int tegra_emc_probe(struct platform_device *pdev)
11191157
platform_set_drvdata(pdev, emc);
11201158

11211159
if (IS_ENABLED(CONFIG_DEBUG_FS))
1122-
emc_debugfs_init(&pdev->dev);
1160+
emc_debugfs_init(&pdev->dev, emc);
11231161

11241162
return 0;
11251163
};

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 */

0 commit comments

Comments
 (0)