From: swarren@wwwdotorg•org (Stephen Warren)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH 8/8] clk: tegra: Add EMC clock driver
Date: Tue, 22 Jul 2014 10:57:22 -0600 [thread overview]
Message-ID: <53CE97F2.80300@wwwdotorg.org> (raw)
In-Reply-To: <1405088313-20048-9-git-send-email-mperttunen@nvidia.com>
On 07/11/2014 08:18 AM, Mikko Perttunen wrote:
> The driver is currently only tested on Tegra124 Jetson TK1, but should
> work with other Tegra124 boards, provided that correct EMC tables are
> provided through the device tree. Older chip models have differing
> timing change sequences, so they are not currently supported.
> diff --git a/drivers/clk/tegra/clk-emc.c b/drivers/clk/tegra/clk-emc.c
> +struct emc_timing {
> + unsigned long rate, parent_rate;
> + u8 parent_index;
> + struct clk *parent;
> +
> + /* Store EMC burst data in a union to minimize mistakes. This allows
> + * us to use the same burst data lists as used by the downstream and
> + * ChromeOS kernels. */
Nit: */ should be on its own line. This applies to many comments in the
file.
> +/* * * * * * * * * * * * * * * * * * * * * * * * * *
> + * Timing change sequence functions *
> + * * * * * * * * * * * * * * * * * * * * * * * * * */
Nit: This kind of banner comment is unusual, but I guess it's fine.
> +static void emc_seq_update_timing(struct tegra_emc *tegra)
...
> + dev_err(&tegra->pdev->dev, "timing update failed\n");
> + BUG();
> +}
Is there any way to avoid all these BUGs? Can we just continue on and
retry the next time, or disallow any further clock rate changes or
something?
> +/* * * * * * * * * * * * * * * * * * * * * * * * * *
> + * Debugfs entry *
> + * * * * * * * * * * * * * * * * * * * * * * * * * */
> +
> +static int emc_debug_rate_get(void *data, u64 *rate)
> +{
> + struct tegra_emc *tegra = data;
> +
> + *rate = clk_get_rate(tegra->hw.clk);
> +
> + return 0;
> +}
> +
> +static int emc_debug_rate_set(void *data, u64 rate)
> +{
> + struct tegra_emc *tegra = data;
> +
> + return clk_set_rate(tegra->hw.clk, rate);
> +}
> +
> +DEFINE_SIMPLE_ATTRIBUTE(emc_debug_rate_fops, emc_debug_rate_get,
> + emc_debug_rate_set, "%lld\n");
I think the rate can already be obtained through
...debug/clock/clock_summary. I'm not sure about changing the rate, but
shouldn't that be a feature of the common clock core, not individual
drivers?
> +static int load_timings_from_dt(struct tegra_emc *tegra,
> + struct device_node *node)
> +{
...
> + for_each_child_of_node(node, child) {
...
> + if (timing->rate <= prev_rate) {
> + dev_err(&tegra->pdev->dev,
> + "timing %s: rate not increasing\n",
> + child->name);
I don't believe there's any guaranteed node enumeration order. If the
driver needs the child nodes sorted, it should sort them itself.
> +static const struct of_device_id tegra_car_of_match[] = {
> + { .compatible = "nvidia,tegra124-car" },
> + {}
> +};
> +
> +static const struct of_device_id tegra_mc_of_match[] = {
> + { .compatible = "nvidia,tegra124-mc" },
> + {}
> +};
It would be better if this driver explicitly called into the driver for
other modules, rather than directly touching their registers.
next prev parent reply other threads:[~2014-07-22 16:57 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-11 14:18 [PATCH 0/8] Tegra124 EMC (external memory controller) support Mikko Perttunen
2014-07-11 14:18 ` [PATCH 1/8] clk: tegra124: Remove old emc_mux and emc clocks Mikko Perttunen
2014-07-11 14:18 ` [PATCH 2/8] ARM: tegra: Remove TEGRA124_CLK_EMC from tegra124-car.h Mikko Perttunen
2014-07-21 22:37 ` Stephen Warren
2014-07-29 8:28 ` Mikko Perttunen
2014-07-11 14:18 ` [PATCH 3/8] ARM: tegra: Add PLL_M_UD and PLL_C_UD to tegra124-car binding header Mikko Perttunen
2014-08-25 17:41 ` Stephen Warren
2014-09-17 13:41 ` Peter De Schrijver
2014-07-11 14:18 ` [PATCH 4/8] clk: tegra124: Add PLL_M_UD and PLL_C_UD clocks Mikko Perttunen
2014-07-11 14:18 ` [PATCH 5/8] of: Add Tegra124 EMC bindings Mikko Perttunen
2014-07-11 14:51 ` Thierry Reding
2014-07-11 16:01 ` Mikko Perttunen
2014-07-14 7:55 ` Mikko Perttunen
2014-07-14 8:15 ` Thierry Reding
2014-07-14 9:06 ` Mikko Perttunen
2014-07-14 9:31 ` Thierry Reding
2014-07-14 9:57 ` Mikko Perttunen
2014-07-14 10:29 ` Thierry Reding
2014-07-14 10:54 ` Mikko Perttunen
2014-07-14 11:10 ` Thierry Reding
2014-07-14 12:28 ` Mikko Perttunen
2014-07-11 16:43 ` Andrew Bresticker
2014-07-11 16:48 ` Mikko Perttunen
2014-07-21 21:28 ` Stephen Warren
2014-07-21 22:52 ` Andrew Bresticker
2014-07-22 16:45 ` Stephen Warren
2014-07-22 17:22 ` Andrew Bresticker
2014-07-22 17:34 ` Stephen Warren
2014-07-29 8:30 ` Mikko Perttunen
2014-07-29 15:49 ` Stephen Warren
2014-07-31 10:48 ` Mikko Perttunen
2014-07-31 11:05 ` Mikko Perttunen
2014-07-31 15:32 ` Stephen Warren
2014-07-21 22:36 ` Stephen Warren
2014-07-11 14:18 ` [PATCH 6/8] ARM: tegra: Add EMC to Tegra124 device tree Mikko Perttunen
2014-07-11 14:18 ` [PATCH 7/8] ARM: tegra: Add EMC timings to Jetson TK1 " Mikko Perttunen
2014-07-11 14:18 ` [PATCH 8/8] clk: tegra: Add EMC clock driver Mikko Perttunen
2014-07-22 16:57 ` Stephen Warren [this message]
2014-07-29 8:47 ` Mikko Perttunen
2014-07-29 20:19 ` Mike Turquette
2014-07-29 22:14 ` Stephen Warren
2014-07-30 9:34 ` Thierry Reding
2014-07-31 19:06 ` Mike Turquette
2014-07-31 19:53 ` Stephen Warren
2014-07-31 23:08 ` Mike Turquette
2014-08-01 6:31 ` Mikko Perttunen
2014-08-01 8:40 ` Thierry Reding
2014-08-25 17:40 ` [PATCH 0/8] Tegra124 EMC (external memory controller) support Stephen Warren
2014-08-26 7:42 ` Mikko Perttunen
2014-08-26 7:47 ` Thierry Reding
2014-08-26 8:02 ` Mikko Perttunen
2014-09-05 10:22 ` Tomeu Vizoso
2014-09-05 10:55 ` Mikko Perttunen
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=53CE97F2.80300@wwwdotorg.org \
--to=swarren@wwwdotorg$(echo .)org \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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