Commit c7d0ff93 authored by Arnd Bergmann's avatar Arnd Bergmann
Browse files

Merge tag 'tegra-for-5.9-memory' of...

Merge tag 'tegra-for-5.9-memory' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux into arm/drivers

memory: tegra: Changes for v5.9-rc1

This contains the Tegra210 EMC frequency scaling support that didn't
make it into v5.8. In addition there are a couple of cleanups and minor
fixes.

* tag 'tegra-for-5.9-memory' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux:
  memory: tegra: Add Tegra132 compatible string match
  memory: tegra: Fix KCONFIG variables for Tegra186 and Tegra194
  memory: tegra: Delete some dead code
  memory: tegra: Avoid unused function warnings
  memory: tegra: Drop <linux/clk-provider.h>
  memory: tegra: Fix an error handling path in tegra186_emc_probe()
  memory: tegra30-emc: Poll EMC-CaR handshake instead of waiting for interrupt
  memory: tegra20-emc: Poll EMC-CaR handshake instead of waiting for interrupt
  memory: tegra: Support derated timings on Tegra210
  memory: tegra: Add EMC scaling sequence code for Tegra210
  memory: tegra: Add EMC scaling support code for Tegra210
  memory: tegra: Make debugfs permissions human-readable

Link: https://lore.kernel.org/r/20200717161300.1661002-3-thierry.reding@gmail.com


Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parents 68be222f 46c01923
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -36,3 +36,17 @@ config TEGRA124_EMC
	  Tegra124 chips. The EMC controls the external DRAM on the board.
	  This driver is required to change memory timings / clock rate for
	  external memory.

config TEGRA210_EMC_TABLE
	bool
	depends on ARCH_TEGRA_210_SOC

config TEGRA210_EMC
	tristate "NVIDIA Tegra210 External Memory Controller driver"
	depends on TEGRA_MC && ARCH_TEGRA_210_SOC
	select TEGRA210_EMC_TABLE
	help
	  This driver is for the External Memory Controller (EMC) found on
	  Tegra210 chips. The EMC controls the external DRAM on the board.
	  This driver is required to change memory timings / clock rate for
	  external memory.
+4 −0
Original line number Diff line number Diff line
@@ -13,5 +13,9 @@ obj-$(CONFIG_TEGRA_MC) += tegra-mc.o
obj-$(CONFIG_TEGRA20_EMC)  += tegra20-emc.o
obj-$(CONFIG_TEGRA30_EMC)  += tegra30-emc.o
obj-$(CONFIG_TEGRA124_EMC) += tegra124-emc.o
obj-$(CONFIG_TEGRA210_EMC_TABLE) += tegra210-emc-table.o
obj-$(CONFIG_TEGRA210_EMC) += tegra210-emc.o
obj-$(CONFIG_ARCH_TEGRA_186_SOC) += tegra186.o tegra186-emc.o
obj-$(CONFIG_ARCH_TEGRA_194_SOC) += tegra186.o tegra186-emc.o

tegra210-emc-y := tegra210-emc-core.o tegra210-emc-cc-r21021.o
+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@
#define MC_EMEM_ARB_TIMING_W2W				0xbc
#define MC_EMEM_ARB_TIMING_R2W				0xc0
#define MC_EMEM_ARB_TIMING_W2R				0xc4
#define MC_EMEM_ARB_MISC2				0xc8
#define MC_EMEM_ARB_DA_TURNS				0xd0
#define MC_EMEM_ARB_DA_COVERS				0xd4
#define MC_EMEM_ARB_MISC0				0xd8
+4 −3
Original line number Diff line number Diff line
@@ -984,6 +984,7 @@ static int tegra_emc_load_timings_from_dt(struct tegra_emc *emc,

static const struct of_device_id tegra_emc_of_match[] = {
	{ .compatible = "nvidia,tegra124-emc" },
	{ .compatible = "nvidia,tegra132-emc" },
	{}
};

@@ -1178,11 +1179,11 @@ static void emc_debugfs_init(struct device *dev, struct tegra_emc *emc)
		return;
	}

	debugfs_create_file("available_rates", S_IRUGO, emc->debugfs.root, emc,
	debugfs_create_file("available_rates", 0444, emc->debugfs.root, emc,
			    &tegra_emc_debug_available_rates_fops);
	debugfs_create_file("min_rate", S_IRUGO | S_IWUSR, emc->debugfs.root,
	debugfs_create_file("min_rate", 0644, emc->debugfs.root,
			    emc, &tegra_emc_debug_min_rate_fops);
	debugfs_create_file("max_rate", S_IRUGO | S_IWUSR, emc->debugfs.root,
	debugfs_create_file("max_rate", 0644, emc->debugfs.root,
			    emc, &tegra_emc_debug_max_rate_fops);
}

+13 −12
Original line number Diff line number Diff line
@@ -185,7 +185,7 @@ static int tegra186_emc_probe(struct platform_device *pdev)
	if (IS_ERR(emc->clk)) {
		err = PTR_ERR(emc->clk);
		dev_err(&pdev->dev, "failed to get EMC clock: %d\n", err);
		return err;
		goto put_bpmp;
	}

	platform_set_drvdata(pdev, emc);
@@ -201,7 +201,7 @@ static int tegra186_emc_probe(struct platform_device *pdev)
	err = tegra_bpmp_transfer(emc->bpmp, &msg);
	if (err < 0) {
		dev_err(&pdev->dev, "failed to EMC DVFS pairs: %d\n", err);
		return err;
		goto put_bpmp;
	}

	emc->debugfs.min_rate = ULONG_MAX;
@@ -211,8 +211,10 @@ static int tegra186_emc_probe(struct platform_device *pdev)

	emc->dvfs = devm_kmalloc_array(&pdev->dev, emc->num_dvfs,
				       sizeof(*emc->dvfs), GFP_KERNEL);
	if (!emc->dvfs)
		return -ENOMEM;
	if (!emc->dvfs) {
		err = -ENOMEM;
		goto put_bpmp;
	}

	dev_dbg(&pdev->dev, "%u DVFS pairs:\n", emc->num_dvfs);

@@ -237,15 +239,10 @@ static int tegra186_emc_probe(struct platform_device *pdev)
			"failed to set rate range [%lu-%lu] for %pC\n",
			emc->debugfs.min_rate, emc->debugfs.max_rate,
			emc->clk);
		return err;
		goto put_bpmp;
	}

	emc->debugfs.root = debugfs_create_dir("emc", NULL);
	if (!emc->debugfs.root) {
		dev_err(&pdev->dev, "failed to create debugfs directory\n");
		return 0;
	}

	debugfs_create_file("available_rates", S_IRUGO, emc->debugfs.root,
			    emc, &tegra186_emc_debug_available_rates_fops);
	debugfs_create_file("min_rate", S_IRUGO | S_IWUSR, emc->debugfs.root,
@@ -254,6 +251,10 @@ static int tegra186_emc_probe(struct platform_device *pdev)
			    emc, &tegra186_emc_debug_max_rate_fops);

	return 0;

put_bpmp:
	tegra_bpmp_put(emc->bpmp);
	return err;
}

static int tegra186_emc_remove(struct platform_device *pdev)
@@ -267,10 +268,10 @@ static int tegra186_emc_remove(struct platform_device *pdev)
}

static const struct of_device_id tegra186_emc_of_match[] = {
#if defined(CONFIG_ARCH_TEGRA186_SOC)
#if defined(CONFIG_ARCH_TEGRA_186_SOC)
	{ .compatible = "nvidia,tegra186-emc" },
#endif
#if defined(CONFIG_ARCH_TEGRA194_SOC)
#if defined(CONFIG_ARCH_TEGRA_194_SOC)
	{ .compatible = "nvidia,tegra194-emc" },
#endif
	{ /* sentinel */ }
Loading