From: Tomeu Vizoso <tomeu.vizoso@collabora.com>
To: linux-tegra@vger.kernel.org
Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>,
mikko.perttunen@kapsi.fi, acourbot@nvidia.com,
Mikko Perttunen <mperttunen@nvidia.com>,
Tomeu Vizoso <tomeu.vizoso@collabora.com>,
Stephen Warren <swarren@wwwdotorg.org>,
Thierry Reding <thierry.reding@gmail.com>,
Alexandre Courbot <gnurou@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH v5 13/14] memory: tegra: Add debugfs entry for getting and setting the EMC rate
Date: Tue, 18 Nov 2014 13:13:15 +0100 [thread overview]
Message-ID: <1416312860-4446-14-git-send-email-tomeu.vizoso@collabora.com> (raw)
In-Reply-To: <1416312860-4446-1-git-send-email-tomeu.vizoso@collabora.com>
From: Mikko Perttunen <mperttunen@nvidia.com>
Will be very useful when tuning memory scaling.
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
---
drivers/memory/tegra/tegra124-emc.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/drivers/memory/tegra/tegra124-emc.c b/drivers/memory/tegra/tegra124-emc.c
index 7036ad5..d4817b6 100644
--- a/drivers/memory/tegra/tegra124-emc.c
+++ b/drivers/memory/tegra/tegra124-emc.c
@@ -18,6 +18,7 @@
#include <linux/clk-provider.h>
#include <linux/clk.h>
#include <linux/clkdev.h>
+#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/of_address.h>
@@ -1036,6 +1037,38 @@ static struct device_node *tegra_emc_find_node_by_ram_code(
return NULL;
}
+/* Debugfs entry */
+
+static int emc_debug_rate_get(void *data, u64 *rate)
+{
+ struct clk *c = data;
+
+ *rate = clk_get_rate(c);
+
+ return 0;
+}
+
+static int emc_debug_rate_set(void *data, u64 rate)
+{
+ struct clk *c = data;
+
+ return clk_set_rate(c, rate);
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(emc_debug_rate_fops, emc_debug_rate_get,
+ emc_debug_rate_set, "%lld\n");
+
+void emc_debugfs_init(void)
+{
+ struct dentry *d;
+
+ d = debugfs_create_file("emc_rate", S_IRUGO | S_IWUSR, NULL,
+ clk_get_sys("tegra-clk-debug", "emc"),
+ &emc_debug_rate_fops);
+ if (!d)
+ pr_warn("failed to create debugfs entries\n");
+}
+
static int tegra_emc_probe(struct platform_device *pdev)
{
struct tegra_emc *tegra;
@@ -1106,6 +1139,8 @@ static int tegra_emc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, tegra);
+ emc_debugfs_init();
+
return 0;
};
--
1.9.3
next prev parent reply other threads:[~2014-11-18 12:24 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-18 12:13 [PATCH v5 00/14] Tegra124 EMC (external memory controller) support Tomeu Vizoso
2014-11-18 12:13 ` [PATCH v5 01/14] clk: tegra124: Remove old emc clock Tomeu Vizoso
2014-11-18 21:23 ` Mike Turquette
2014-11-18 12:13 ` [PATCH v5 02/14] of: Document long-ram-code property in nvidia,tegra20-apbmisc Tomeu Vizoso
2014-11-18 12:13 ` [PATCH v5 03/14] soc/tegra: Add ram code reader helper Tomeu Vizoso
2014-11-18 12:13 ` [PATCH v5 04/14] of: document new emc-timings subnode in nvidia,tegra124-car Tomeu Vizoso
2014-11-18 12:13 ` [PATCH v5 05/14] of: Document timings subnode of nvidia,tegra-mc Tomeu Vizoso
2014-11-18 12:13 ` [PATCH v5 06/14] of: Add Tegra124 EMC bindings Tomeu Vizoso
2014-11-18 12:13 ` [PATCH v5 07/14] of: document external-memory-controller property in tegra124-car Tomeu Vizoso
2014-11-18 12:13 ` [PATCH v5 08/14] ARM: tegra: Add EMC to Tegra124 device tree Tomeu Vizoso
2014-11-18 12:13 ` [PATCH v5 09/14] ARM: tegra: Add EMC timings to Jetson TK1 " Tomeu Vizoso
2014-11-18 12:13 ` [PATCH v5 10/14] memory: tegra: Add API needed by the EMC driver Tomeu Vizoso
2014-11-18 12:13 ` [PATCH v5 11/14] memory: tegra: Add EMC (external memory controller) driver Tomeu Vizoso
2014-11-18 12:13 ` [PATCH v5 12/14] clk: tegra: Add EMC clock driver Tomeu Vizoso
2014-11-18 21:33 ` Mike Turquette
2014-11-19 15:29 ` Nikolaus Schulz
2015-01-02 16:27 ` Peter De Schrijver
2015-01-05 13:59 ` Thierry Reding
2015-03-12 9:30 ` Tomeu Vizoso
2014-11-18 12:13 ` Tomeu Vizoso [this message]
2014-11-18 12:13 ` [PATCH v5 14/14] clk: tegra: Set the EMC clock as the parent of the MC clock Tomeu Vizoso
2014-11-18 21:35 ` Mike Turquette
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1416312860-4446-14-git-send-email-tomeu.vizoso@collabora.com \
--to=tomeu.vizoso@collabora.com \
--cc=acourbot@nvidia.com \
--cc=gnurou@gmail.com \
--cc=javier.martinez@collabora.co.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=mikko.perttunen@kapsi.fi \
--cc=mperttunen@nvidia.com \
--cc=swarren@wwwdotorg.org \
--cc=thierry.reding@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).