From: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
To: Peter De Schrijver
<pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: Mike Turquette
<mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Prashant Gaikwad
<pgaikwad-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
Thierry Reding
<thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>,
Joseph Lo <josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
Paul Walmsley <pwalmsley-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 01/12] clk: tegra: simplify periph clock data
Date: Mon, 23 Sep 2013 11:29:33 -0600 [thread overview]
Message-ID: <52407A7D.6080002@wwwdotorg.org> (raw)
In-Reply-To: <1379515331-19427-2-git-send-email-pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
On 09/18/2013 08:40 AM, Peter De Schrijver wrote:
> This patch determines the register bank for clock enable/disable and reset
> based on the clock ID instead of hardcoding it in the tables describing the
> clocks. This results in less data to be maintained in the tables, making the
> code easier to understand. The full benefit of the change will be realized once
> also other clocktypes will be table based.
> drivers/clk/tegra/clk-tegra114.c | 483 ++++++++++++++++----------------------
> drivers/clk/tegra/clk.c | 105 ++++++++
> drivers/clk/tegra/clk.h | 3 +
Can't this change be applied to the Tegra20/30 diffstat too, for even
more negative diffstat? Similar comments probably apply for other
patches in the series.
> diff --git a/drivers/clk/tegra/clk-tegra114.c b/drivers/clk/tegra/clk-tegra114.c
> #define TEGRA_INIT_DATA_MUX(_name, _con_id, _dev_id, _parents, _offset, \
> - _clk_num, _regs, _gate_flags, _clk_id) \
> + _clk_num, _gate_flags, _clk_id) \
> TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\
> - 30, MASK(2), 0, 0, 8, 1, 0, _regs, _clk_num, \
> - periph_clk_enb_refcnt, _gate_flags, _clk_id, \
> - _parents##_idx, 0)
> + 30, MASK(2), 0, 0, 8, 1, 0, 0,\
> + _clk_num, periph_clk_enb_refcnt, _gate_flags,\
> + _clk_id, _parents##_idx, 0)
Nit: A simple s/_regs/0/ without re-flowing the parameters would have
made that diff smaller, and more similar to all the others...
> @@ -1606,9 +1538,9 @@ static void __init tegra114_audio_clk_init(void __iomem *clk_base)
> clk = tegra_clk_register_divider("audio0_div", "audio0_doubler",
> clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 24, 1,
> 0, &clk_doubler_lock);
> - clk = tegra_clk_register_periph_gate("audio0_2x", "audio0_div",
> + clk = tegra114_periph_gate_helper("audio0_2x", "audio0_div",
> TEGRA_PERIPH_NO_RESET, clk_base,
> - CLK_SET_RATE_PARENT, 113, &periph_v_regs,
> + CLK_SET_RATE_PARENT, 113,
> periph_clk_enb_refcnt);
> clk_register_clkdev(clk, "audio0_2x", NULL);
> clks[TEGRA114_CLK_AUDIO0_2X] = clk;
It sure seems like much of this repetitive code could be driven from a
data table rather than cut/paste code. Perhaps a later patch in this
series cleans this up?
> @@ -2030,21 +1949,10 @@ static __init void tegra114_periph_clk_init(void __iomem *clk_base)
...
> - /* dsib */
> - clk = clk_register_mux(NULL, "dsib_mux", mux_plld_out0_plld2_out0,
> - ARRAY_SIZE(mux_plld_out0_plld2_out0), 0,
> - clk_base + PLLD2_BASE, 25, 1, 0, &pll_d2_lock);
> - clks[TEGRA114_CLK_DSIB_MUX] = clk;
> - clk = tegra_clk_register_periph_gate("dsib", "dsib_mux", 0, clk_base,
> - 0, 82, &periph_u_regs,
> - periph_clk_enb_refcnt);
> - clks[TEGRA114_CLK_DSIB] = clk;
> -
Why delete dsib? I don't think it got added elsewhere in this patch.
> @@ -2077,21 +1982,36 @@ static __init void tegra114_periph_clk_init(void __iomem *clk_base)
> for (i = 0; i < ARRAY_SIZE(tegra_periph_clk_list); i++) {
> + struct tegra_clk_periph_regs *bank;
> +
> data = &tegra_periph_clk_list[i];
> - clk = tegra_clk_register_periph(data->name, data->parent_names,
> - data->num_parents, &data->periph,
> - clk_base, data->offset, data->flags);
> + bank = get_reg_bank(data->periph.gate.clk_num);
> +
> + if (!bank)
> + continue;
Nit: I dislike blank lines between the code that retrieves a value, and
the immediately following error-check of the value. This applies to the
second change to this function too.
> @@ -2337,6 +2257,9 @@ static void __init tegra114_clock_init(struct device_node *np)
> if (tegra114_osc_clk_init(clk_base) < 0)
> return;
>
> + if (tegra_clk_periph_banks(5) < 0)
> + return;
Is that just debugging code? If you intend to keep this as a permanent
run-time check, wouldn't it be better to validate the result of
get_reg_bank(max_tegra114_periph_clock_id)? But, I'm not sure the check
is necessary at all, since the result of get_reg_bank() is checked when
registering each individual clock, so there's already plenty of coverage.
next prev parent reply other threads:[~2013-09-23 17:29 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-18 14:40 [PATCH 00/12] Introduce common infra for tegra clocks Peter De Schrijver
2013-09-18 14:40 ` [PATCH 03/12] clk: tegra: Add TEGRA_PERIPH_NO_DIV flag Peter De Schrijver
[not found] ` <1379515331-19427-4-git-send-email-pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-09-23 17:52 ` Stephen Warren
2013-09-18 14:40 ` [PATCH 06/12] clk: tegra: add common infra for DT clocks Peter De Schrijver
2013-09-23 18:16 ` Stephen Warren
[not found] ` <1379515331-19427-1-git-send-email-pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-09-18 14:40 ` [PATCH 01/12] clk: tegra: simplify periph clock data Peter De Schrijver
[not found] ` <1379515331-19427-2-git-send-email-pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-09-23 17:29 ` Stephen Warren [this message]
2013-09-18 14:40 ` [PATCH 02/12] clk: tegra: periph_clk_enb_refcnt as common infra Peter De Schrijver
2013-09-18 14:40 ` [PATCH 04/12] clk: tegra: move some PLLC and PLLXC init to clk-pll.c Peter De Schrijver
2013-09-18 14:40 ` [PATCH 05/12] clk: tegra: add header for common tegra clock IDs Peter De Schrijver
2013-09-23 18:05 ` Stephen Warren
[not found] ` <524082E3.8070801-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-09-24 8:08 ` Peter De Schrijver
2013-09-18 14:40 ` [PATCH 07/12] clk: tegra: move audio clk to common file Peter De Schrijver
2013-09-23 18:22 ` Stephen Warren
2013-09-18 14:41 ` [PATCH 08/12] clk: tegra: move periph clocks " Peter De Schrijver
[not found] ` <1379515331-19427-9-git-send-email-pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-09-23 18:31 ` Stephen Warren
2013-09-24 8:20 ` Peter De Schrijver
[not found] ` <20130924082004.GJ30013-Rysk9IDjsxmJz7etNGeUX8VPkgjIgRvpAL8bYrjMMd8@public.gmane.org>
2013-09-24 16:44 ` Stephen Warren
2013-09-18 14:41 ` [PATCH 09/12] clk: tegra: move PMC " Peter De Schrijver
2013-09-18 14:41 ` [PATCH 10/12] clk: tegra: move fixed " Peter De Schrijver
2013-09-23 18:34 ` Stephen Warren
[not found] ` <524089C8.4010108-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-09-24 8:32 ` Peter De Schrijver
[not found] ` <20130924083231.GK30013-Rysk9IDjsxmJz7etNGeUX8VPkgjIgRvpAL8bYrjMMd8@public.gmane.org>
2013-09-24 16:47 ` Stephen Warren
2013-09-18 14:41 ` [PATCH 11/12] clk: tegra: introduce common tegra_osc_clk_init Peter De Schrijver
2013-09-18 14:41 ` [PATCH 12/12] clk: tegra: introduce common gen4 super clock Peter De Schrijver
2013-09-23 18:38 ` Stephen Warren
2013-09-18 14:48 ` [PATCH 00/12] Introduce common infra for tegra clocks Peter De Schrijver
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=52407A7D.6080002@wwwdotorg.org \
--to=swarren-3lzwwm7+weoh9zmkesr00q@public.gmane.org \
--cc=josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=pgaikwad-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=pwalmsley-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org \
/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