linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
To: Peter De Schrijver
	<pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: Joseph Lo <josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	Thierry Reding
	<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	Mike Turquette
	<mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Subject: Re: [PATCH 2/4] clk: tegra: add EMC clock driver
Date: Thu, 19 Dec 2013 12:44:43 -0700	[thread overview]
Message-ID: <52B34CAB.5060705@wwwdotorg.org> (raw)
In-Reply-To: <20131219100557.GE17188-Rysk9IDjsxmJz7etNGeUX8VPkgjIgRvpAL8bYrjMMd8@public.gmane.org>

On 12/19/2013 03:05 AM, Peter De Schrijver wrote:
>>> I guess using the clk_notifier may be OK for the 1st case.
>>
>> In both cases, isn't the overall operation something like:
>>
>> a) Do some work before changing the EMC clock
>> b) Change the EMC clock
>> c) Do some work after changing the EMC clock
>>
> 
> There is hw interaction between the EMC controller and the CAR module.
> Writing to the EMC clock source register in CAR will trigger a state machine
> in the EMC controller to handle the change of memory clock. The details
> of the state machine and how it needs to be setup are different for
> each Tegra variant. This means we need to be sure of the exact sequence
> of CAR and EMC register accesses for this to work. In theory this could
> be done with pre and post rate change notifiers, but I'm afraid this would
> be quite fragile.

Isn't the state machine setup something that the EMC driver does through
EMC registers (or perhaps also using flow controller registers?). If all
the clock driver does for this clock is program the requested rate,
which triggers the HW state machine, then I think we can isolate
everything else into the EMC driver.

In such a case, we don't need to use pre-/post-rate change notifiers at
all; just have the EMC driver call into the clock driver at the
appropriate step in the process where the clock registers should be written.

> 
>> Admittedly, the exact definition of "some work" is different for your
>> cases (1) and (2) above, but the overall structure is the same. As such,
>> can't the EMC scaling driver do (a), then do (b) i.e. call
>> clk_set_rate(), then do (c)? Or, in your case (2), do we need to do
> 
> We would need to be very sure clk_set_rate() doesn't access any other register
> besides the EMC clock source register before returning to the EMC scaling
> driver.

Well, we can certainly make that happen. We're writing the code behind
clk_set_rate() for the EMC clock after all...

But I'm not sure why that is a requirement. If it is, we're pretty
screwed, because surely there's nothing stopping some other driver
that's running on a different CPU from coming along and changing some
completely unrelated clock, which will then touch "some other register".

  parent reply	other threads:[~2013-12-19 19:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-17  9:26 [PATCH 0/4] ARM: tegra: re-enable EMC scaling function for Tegra20 Joseph Lo
     [not found] ` <1387272400-4689-1-git-send-email-josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-12-17  9:26   ` [PATCH 1/4] ARM: tegra: moving tegra_bct_strapping to tegra-soc.h for global visibility Joseph Lo
     [not found]     ` <1387272400-4689-2-git-send-email-josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-12-17 22:53       ` Stephen Warren
     [not found]         ` <52B0D5EF.5090703-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-12-18  8:20           ` Joseph Lo
2013-12-17 22:58       ` Stephen Warren
2013-12-17  9:26   ` [PATCH 2/4] clk: tegra: add EMC clock driver Joseph Lo
     [not found]     ` <1387272400-4689-3-git-send-email-josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-12-17 22:58       ` Stephen Warren
     [not found]         ` <52B0D6FA.2060101-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-12-18  9:42           ` Joseph Lo
     [not found]             ` <1387359758.2576.38.camel-yx3yKKdKkHfc7b1ADBJPm0n48jw8i0AO@public.gmane.org>
2013-12-18 18:28               ` Stephen Warren
     [not found]                 ` <52B1E950.1040001-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-12-18 19:30                   ` Mike Turquette
2013-12-19  8:57                     ` Joseph Lo
2013-12-19  9:43                   ` Joseph Lo
     [not found]                     ` <1387446199.13057.26.camel-yx3yKKdKkHfc7b1ADBJPm0n48jw8i0AO@public.gmane.org>
2013-12-19 19:41                       ` Stephen Warren
2013-12-19 10:05                   ` Peter De Schrijver
     [not found]                     ` <20131219100557.GE17188-Rysk9IDjsxmJz7etNGeUX8VPkgjIgRvpAL8bYrjMMd8@public.gmane.org>
2013-12-19 11:43                       ` Lucas Stach
2013-12-19 11:46                         ` Peter De Schrijver
2013-12-19 19:44                       ` Stephen Warren [this message]
     [not found]                         ` <52B34CAB.5060705-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-12-20 11:34                           ` Peter De Schrijver
2013-12-17  9:26   ` [PATCH 3/4] memory: tegra20-emc: move out Tegra20 EMC driver from mach-tegra Joseph Lo
2013-12-17  9:26   ` [PATCH 4/4] clk: tegra20: enable EMC clock driver Joseph Lo
     [not found]     ` <1387272400-4689-5-git-send-email-josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-12-17 23:02       ` 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=52B34CAB.5060705@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-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@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;
as well as URLs for NNTP newsgroup(s).