devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To: "David Lanzendörfer" <david.lanzendoerfer-Z7Kmv9EsliU@public.gmane.org>
Cc: Mike Turquette
	<mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Emilio Lopez <emilio-0Z03zUJReD5OxF6Tv1QG9Q@public.gmane.org>,
	chris-OsFVWbfNK3isTnJN9+BGXg@public.gmane.org,
	ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	wens-jdAy2FN1RRM@public.gmane.org
Subject: Re: [PATCH v3 11/12] mmc: sunxi: Convert MMC driver to the standard clock phase API
Date: Fri, 26 Sep 2014 17:02:04 +0200	[thread overview]
Message-ID: <20140926150204.GT15315@lukather> (raw)
In-Reply-To: <3992138.y6J8TjIuMq-pgFh0Jf6HD9Xzn/AsuzBOg@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1112 bytes --]

On Fri, Sep 26, 2014 at 04:27:10PM +0200, David Lanzendörfer wrote:
> Hello
> > Now that we have proper support to use the generic phase API in our clock
> > driver, switch the MMC driver to use it.
> > [...]
> >  	/* determine delays */
> >  	if (rate <= 400000) {
> > -		oclk_dly = 0;
> > -		sclk_dly = 7;
> > +		oclk_dly = 180;
> > +		sclk_dly = 42;
> > [...]
> How did you calculate the actual phase values from the original parameters?

Like shown in the clock driver. 0 is always a 180 deg phase shift, and
any other value is the number of the parent clock cycle to outphase
the clock of.

the clock out phase is calculating using:

phase = 360 * interval / period.

with period = 1 / (parent_freq / divider)
and interval = reg / parent_freq

which makes

phase = 360 * (reg / parent_freq) * (parent_freq / divider)

If we simplify by removing the parent_freq, we end up with

phase = 360 * reg / divider, which makes it rather trivial to
calculate.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2014-09-26 15:02 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-11 20:18 [PATCH v3 00/12] clk: sunxi: Improve MMC clocks support Maxime Ripard
2014-09-11 20:18 ` [PATCH v3 01/12] clk: introduce clk_set_phase function & callback Maxime Ripard
2014-09-24 10:41   ` Heiko Stübner
2014-09-11 20:18 ` [PATCH v3 02/12] clk: Include of.h in clock-provider.h Maxime Ripard
2014-09-11 20:18 ` [PATCH v3 03/12] clk: Add a function to retrieve phase Maxime Ripard
2014-09-24 10:42   ` Heiko Stübner
2014-09-28  0:17   ` Mike Turquette
2014-09-29  8:24     ` Maxime Ripard
2014-09-30  7:01       ` Mike Turquette
2014-09-11 20:18 ` [PATCH v3 05/12] clk: sunxi: Introduce mbus compatible Maxime Ripard
2014-09-11 20:18 ` [PATCH v3 07/12] clk: sunxi: Move mod0 clock to a file of its own Maxime Ripard
2014-09-11 20:18 ` [PATCH v3 08/12] clk: sunxi: Move mbus to mod0 file Maxime Ripard
     [not found] ` <1410466706-27386-1-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-09-11 20:18   ` [PATCH v3 04/12] clk: sunxi: factors: Invert the probing logic Maxime Ripard
2014-09-11 20:18   ` [PATCH v3 06/12] ARM: sunxi: dt: Switch to the new mbus compatible Maxime Ripard
2014-09-11 20:18   ` [PATCH v3 09/12] ARM: sunxi: dt: Add sample and output mmc clocks Maxime Ripard
2014-09-12 10:23     ` Chen-Yu Tsai
2014-09-13  8:18       ` Maxime Ripard
2014-09-13  8:24         ` Chen-Yu Tsai
2014-09-11 20:18 ` [PATCH v3 10/12] clk: sunxi: mod0: Introduce MMC proper phase handling Maxime Ripard
2014-09-11 20:18 ` [PATCH v3 11/12] mmc: sunxi: Convert MMC driver to the standard clock phase API Maxime Ripard
2014-09-26 14:27   ` David Lanzendörfer
     [not found]     ` <3992138.y6J8TjIuMq-pgFh0Jf6HD9Xzn/AsuzBOg@public.gmane.org>
2014-09-26 15:02       ` Maxime Ripard [this message]
2014-09-26 20:47         ` David Lanzendörfer
2014-09-11 20:18 ` [PATCH v3 12/12] clk: sunxi: Remove custom phase function Maxime Ripard
2014-09-12  7:22 ` [PATCH v3 00/12] clk: sunxi: Improve MMC clocks support Hans de Goede
2014-09-22 11:31 ` Maxime Ripard
2014-09-26  0:42   ` Mike Turquette
2014-09-26  6:55     ` Maxime Ripard
2014-09-26 17:52       ` 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=20140926150204.GT15315@lukather \
    --to=maxime.ripard-wi1+55scjutkeb57/3fjtnbpr1lh4cv8@public.gmane.org \
    --cc=chris-OsFVWbfNK3isTnJN9+BGXg@public.gmane.org \
    --cc=david.lanzendoerfer-Z7Kmv9EsliU@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=emilio-0Z03zUJReD5OxF6Tv1QG9Q@public.gmane.org \
    --cc=hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=wens-jdAy2FN1RRM@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).