From: Stephen Warren <swarren@wwwdotorg.org>
To: Peter De Schrijver <pdeschrijver@nvidia.com>
Cc: Prashant Gaikwad <pgaikwad@nvidia.com>,
	Mike Turquette <mturquette@linaro.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	Rob Herring <rob.herring@calxeda.com>,
	Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Hiroshi Doyu <hdoyu@nvidia.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-tegra@vger.kernel.org" <linux-tegra@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH v3 02/19] clk: tegra: simplify periph clock data
Date: Wed, 16 Oct 2013 11:06:16 -0600	[thread overview]
Message-ID: <525EC788.9000309@wwwdotorg.org> (raw)
In-Reply-To: <20131016150619.GM5643@tbergstrom-lnx.Nvidia.com>
On 10/16/2013 09:06 AM, Peter De Schrijver wrote:
> On Tue, Oct 15, 2013 at 08:46:21PM +0200, Stephen Warren wrote:
>> On 10/15/2013 08:52 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.
>>
>>> diff --git a/drivers/clk/tegra/clk-tegra114.c b/drivers/clk/tegra/clk-tegra114.c
>>>  	for (i = 0; i < ARRAY_SIZE(tegra_periph_clk_list); i++) {
>>>  		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);
>>> +
>>> +		clk = tegra_clk_register_periph(data->name,
>>> +			data->parent_names, data->num_parents, &data->periph,
>>> +			clk_base, data->offset, data->flags);
>>>  		clks[data->clk_id] = clk;
>>>  	}
>>>  
>>>  	for (i = 0; i < ARRAY_SIZE(tegra_periph_nodiv_clk_list); i++) {
>>>  		data = &tegra_periph_nodiv_clk_list[i];
>>> +
>>>  		clk = tegra_clk_register_periph_nodiv(data->name,
>>
>> Nit: Seems like an unrelated change, and inconsistent with the other
>> loop above.
> 
> Actually it makes it consistent. The previous loop added an empty line
> between data = ... and tegra_clk_register_periph()
Oh right, I see you added the blank line in the chunk about and I'd
overlooked that. I guess it's fine.
>>> diff --git a/drivers/clk/tegra/clk.c b/drivers/clk/tegra/clk.c
>>
>>> +struct tegra_clk_periph_regs * __init get_reg_bank(int clkid)
>>> +{
>>> +	int reg_bank = clkid / 32;
>>> +
>>> +	if (reg_bank < periph_banks)
>>> +		return &periph_regs[reg_bank];
>>> +	else {
>>> +		WARN_ON(1);
>>> +		return NULL;
>>> +	}
>>> +}
>>> +
>>> +int __init tegra_clk_periph_banks(int num)
>>> +{
>>> +	if (num > ARRAY_SIZE(periph_regs))
>>> +		return -EINVAL;
>>> +
>>> +	periph_banks = num;
>>> +
>>> +	return 0;
>>> +}
>>
>> Shouldn't the condition in tegra_clk_periph_banks() check against
>> periph_banks rather than ARRAY_SIZE(periph_regs)? I assume the calls to
> 
> periph_banks is initialized in tegra_clk_periph_banks(), so I don't see how
> that would work?
Yes, indeed!
>> tegra_clk_periph_banks() from tegra*_clock_init() are intended to ensure
>> that periph_regs is set up correctly in this file? I wonder if
>> s/tegra_clk_periph_banks/tegra_clk_validate_periph_bank_count/ isn't
>> called for?
> 
> Yes. The calls are intended to ensure that the clk-tegra* files, don't
> refer to register banks which don't have addresses specified. This could happen
> if a wrong periph clk ID would be specified for example. In later patches
> we will also allocate memory based on the number of register banks.
Ah, so perhaps s/tegra_clk_periph_banks/tegra_clk_set_periph_banks/
would make it more obvious what it's doing.
next prev parent reply	other threads:[~2013-10-16 17:06 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-15 14:52 [PATCH v3 00/19] Introduce common infra for tegra clocks Peter De Schrijver
2013-10-15 14:52 ` [PATCH v3 01/19] ARM: tegra30: add missing CLK IDs Peter De Schrijver
2013-10-15 14:52 ` [PATCH v3 02/19] clk: tegra: simplify periph clock data Peter De Schrijver
     [not found]   ` <1381848794-11761-3-git-send-email-pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-10-15 18:46     ` Stephen Warren
     [not found]       ` <525D8D7D.10301-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-10-16 15:06         ` Peter De Schrijver
2013-10-16 17:06           ` Stephen Warren [this message]
2013-10-15 14:52 ` [PATCH v3 03/19] clk: tegra: common periph_clk_enb_refcnt and clks Peter De Schrijver
     [not found]   ` <1381848794-11761-4-git-send-email-pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-10-15 18:52     ` Stephen Warren
2013-10-15 14:52 ` [PATCH v3 05/19] clk: tegra: move some PLLC and PLLXC init to clk-pll.c Peter De Schrijver
     [not found]   ` <1381848794-11761-6-git-send-email-pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-10-15 18:59     ` Stephen Warren
2013-10-15 14:52 ` [PATCH v3 06/19] clk: tegra: move fields to tegra_clk_pll_params Peter De Schrijver
2013-10-15 14:52 ` [PATCH v3 07/19] clk: tegra: add header for common tegra clock IDs Peter De Schrijver
2013-10-15 14:52 ` [PATCH v3 08/19] clk: tegra: add common infra for DT clocks Peter De Schrijver
     [not found]   ` <1381848794-11761-9-git-send-email-pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-10-15 19:01     ` Stephen Warren
     [not found]       ` <525D9117.9050009-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-10-16 14:34         ` Peter De Schrijver
     [not found]           ` <20131016143448.GK5643-Rysk9IDjsxmJz7etNGeUX8VPkgjIgRvpAL8bYrjMMd8@public.gmane.org>
2013-10-16 17:02             ` Stephen Warren
2013-10-15 14:52 ` [PATCH v3 09/19] clk: tegra: add clkdev registration infra Peter De Schrijver
2013-10-15 19:08   ` Stephen Warren
2013-10-15 14:52 ` [PATCH v3 10/19] clk: tegra: move audio clk to common file Peter De Schrijver
     [not found]   ` <1381848794-11761-11-git-send-email-pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-10-15 19:13     ` Stephen Warren
     [not found]       ` <525D93E8.1010903-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-10-16  7:35         ` Peter De Schrijver
2013-10-15 14:52 ` [PATCH v3 11/19] clk: tegra: move periph clocks " Peter De Schrijver
     [not found]   ` <1381848794-11761-12-git-send-email-pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-10-15 19:19     ` Stephen Warren
2013-10-15 14:52 ` [PATCH v3 12/19] clk: tegra: move PMC, fixed clocks to common files Peter De Schrijver
2013-10-15 14:52 ` [PATCH v3 13/19] clk: tegra: introduce common gen4 super clock Peter De Schrijver
     [not found]   ` <1381848794-11761-14-git-send-email-pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-10-15 19:37     ` Stephen Warren
     [not found]       ` <525D9973.2070501-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-10-16  7:38         ` Peter De Schrijver
2013-10-15 14:52 ` [PATCH v3 14/19] clk: tegra30: replace enum by binding header Peter De Schrijver
     [not found]   ` <1381848794-11761-15-git-send-email-pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-10-15 19:41     ` Stephen Warren
     [not found]       ` <525D9A85.40102-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-10-16 14:46         ` Peter De Schrijver
     [not found]           ` <20131016144618.GL5643-Rysk9IDjsxmJz7etNGeUX8VPkgjIgRvpAL8bYrjMMd8@public.gmane.org>
2013-10-16 17:02             ` Stephen Warren
2013-10-15 14:53 ` [PATCH v3 16/19] clk: tegra20: move tegra20 to common clkdev Peter De Schrijver
2013-10-15 14:53 ` [PATCH v3 17/19] clk: tegra30: move tegra30 " Peter De Schrijver
2013-10-15 14:53 ` [PATCH v3 18/19] clk: tegra20: move to common periph clk Peter De Schrijver
2013-10-15 14:53 ` [PATCH v3 19/19] clk: tegra30: move to common tegra clk infra Peter De Schrijver
     [not found]   ` <1381848794-11761-20-git-send-email-pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-10-15 19:43     ` Stephen Warren
     [not found] ` <1381848794-11761-1-git-send-email-pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-10-15 14:52   ` [PATCH v3 04/19] clk: tegra: Add TEGRA_PERIPH_NO_DIV flag Peter De Schrijver
2013-10-15 14:53   ` [PATCH v3 15/19] clk: tegra20: replace enum by binding header Peter De Schrijver
2013-10-15 17:48   ` [PATCH v3 00/19] Introduce common infra for tegra clocks Stephen Warren
     [not found]     ` <525D8009.5040907-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-10-16  9:06       ` Peter De Schrijver
     [not found]         ` <20131016090643.GI5643-Rysk9IDjsxmJz7etNGeUX8VPkgjIgRvpAL8bYrjMMd8@public.gmane.org>
2013-10-16 17:14           ` Stephen Warren
2013-10-17  7:52             ` Peter De Schrijver
2013-10-15 19:43   ` Stephen Warren
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=525EC788.9000309@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=devicetree@vger.kernel.org \
    --cc=hdoyu@nvidia.com \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mturquette@linaro.org \
    --cc=pawel.moll@arm.com \
    --cc=pdeschrijver@nvidia.com \
    --cc=pgaikwad@nvidia.com \
    --cc=rob.herring@calxeda.com \
    --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).