devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: Shawn Guo <shawn.guo-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	linaro-dev-cunTk1MwBs8s++Sfvej+rw@public.gmane.org,
	patches-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org
Subject: Re: [PATCH 2/5] arm/mxc: add clk members to ease dt clock support
Date: Tue, 15 Mar 2011 02:02:56 -0600	[thread overview]
Message-ID: <20110315080256.GM23050@angua.secretlab.ca> (raw)
In-Reply-To: <20110315075028.GG11098-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>

On Tue, Mar 15, 2011 at 03:50:29PM +0800, Shawn Guo wrote:
> On Tue, Mar 15, 2011 at 01:41:01AM -0600, Grant Likely wrote:
> > On Tue, Mar 08, 2011 at 11:56:34AM +0800, Shawn Guo wrote:
> > > On Mon, Mar 07, 2011 at 10:53:37AM -0700, Grant Likely wrote:
> > > > On Mon, Mar 7, 2011 at 9:22 AM, Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> > > > > The 'rate' is added for fixed-clock support, while 'pll_base' is for
> > > > > pll clock.  These two particular type of clocks are supposed to be
> > > > > gracefully supported by the common clk api when it gets ready.
> > > > 
> > > > How does the current imx clock code handle fixed and pll clocks?
> > > 
> > > For fixed-clock, the current code gets several variables holding the
> > > rate and then return the rate from several get_rate functions.
> > > 
> > > static unsigned long external_high_reference, external_low_reference;
> > > static unsigned long oscillator_reference, ckih2_reference;
> > > 
> > > static unsigned long get_high_reference_clock_rate(struct clk *clk)
> > > {
> > >         return external_high_reference;
> > > }
> > > 
> > > static unsigned long get_low_reference_clock_rate(struct clk *clk)
> > > {
> > >         return external_low_reference;
> > > }
> > > 
> > > static unsigned long get_oscillator_reference_clock_rate(struct clk *clk)
> > > {
> > >         return oscillator_reference;
> > > }
> > > 
> > > static unsigned long get_ckih2_reference_clock_rate(struct clk *clk)
> > > {
> > >         return ckih2_reference;
> > > }
> > > 
> > > With this new rate member added, all these can be consolidated into one.
> > > 
> > > For base address of pll, the current code uses the reference to clocks
> > > statically defined to know which pll is the one.
> > > 
> > > static inline void __iomem *_mx51_get_pll_base(struct clk *pll)
> > > {
> > > #ifdef CONFIG_OF
> > >         return pll->pll_base;
> > > #else
> > >         if (pll == &pll1_main_clk)
> > >                 return MX51_DPLL1_BASE;
> > >         else if (pll == &pll2_sw_clk)
> > >                 return MX51_DPLL2_BASE;
> > >         else if (pll == &pll3_sw_clk)
> > >                 return MX51_DPLL3_BASE;
> > >         else
> > >                 BUG();
> > > 
> > >         return NULL;
> > > #endif
> > 
> > Be careful about stuff like this.  Remember that enabling CONFIG_OF
> > must *not break* board support that does not use the device tree.  The
> > above #ifdef block will break existing users.
> > 
> Though the code has been killed in the latest version I just sent
> yesterday I sent last night, I do not understand how it will break
> the existing users.  The existing code is:
> 
> static inline void __iomem *_mx51_get_pll_base(struct clk *pll)
> {
>         if (pll == &pll1_main_clk)
>                 return MX51_DPLL1_BASE;
>         else if (pll == &pll2_sw_clk)
>                 return MX51_DPLL2_BASE;
>         else if (pll == &pll3_sw_clk)
>                 return MX51_DPLL3_BASE;
>         else
>                 BUG();
> 
>         return NULL;
> }

What you wrote wrapped the current implementation with #ifdef
CONFIG_OF ... #else [existing code] #endif.  That says to me that when
CONFIG_OF is enabled, the old code gets compiled out, which means the
function no longer works on non-dt platforms.

The goal is to support both dt and non-dt machines with a single
kernel image.

g.

> 
> -- 
> Regards,
> Shawn
> 

  parent reply	other threads:[~2011-03-15  8:02 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-07 16:22 [PATCH RFC 0/5] Dynamically add clk to clkdev per dt clock nodes Shawn Guo
     [not found] ` <1299514932-13558-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-03-07 16:22   ` [PATCH 1/5] arm/dts: babbage: add gpt and uart related " Shawn Guo
     [not found]     ` <1299514932-13558-2-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-03-07 17:48       ` Grant Likely
     [not found]         ` <AANLkTimn4fNvM0bSHnpuQmCAweTZ00JQCZCZ=vOdV4NZ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-03-08  3:44           ` Shawn Guo
     [not found]             ` <20110308034447.GB14370-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2011-03-12  5:55               ` Shawn Guo
2011-03-13  8:08               ` Shawn Guo
2011-03-08  6:56       ` Jason Hui
     [not found]         ` <AANLkTima=zGr96dZUaYvCN6oE=KCY=ySOgOLweEJYk97-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-03-08  7:07           ` Shawn Guo
     [not found]             ` <20110308070716.GA16642-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2011-03-08  7:27               ` Jason Hui
2011-03-07 16:22   ` [PATCH 2/5] arm/mxc: add clk members to ease dt clock support Shawn Guo
     [not found]     ` <1299514932-13558-3-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-03-07 17:53       ` Grant Likely
     [not found]         ` <AANLkTikZsMxs1dXgBxVEar+MLF0j4ROZO+uTmo+OSF4s-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-03-08  3:56           ` Shawn Guo
     [not found]             ` <20110308035633.GD14370-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2011-03-13 15:19               ` Shawn Guo
2011-03-15  7:41               ` Grant Likely
     [not found]                 ` <20110315074101.GH23050-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2011-03-15  7:50                   ` Shawn Guo
     [not found]                     ` <20110315075028.GG11098-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2011-03-15  8:02                       ` Grant Likely [this message]
     [not found]                         ` <20110315080256.GM23050-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2011-03-15  8:05                           ` Shawn Guo
2011-03-07 16:22   ` [PATCH 3/5] arm/dt: mx51: dynamically add gpt and uart related clocks per dt nodes Shawn Guo
     [not found]     ` <1299514932-13558-4-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-03-15  7:37       ` Grant Likely
     [not found]         ` <20110315073731.GG23050-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2011-03-16 12:04           ` Shawn Guo
     [not found]             ` <20110316120455.GA11658-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2011-03-17 20:47               ` Grant Likely
     [not found]                 ` <20110317204748.GJ12824-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2011-03-18 16:35                   ` Shawn Guo
2011-03-07 16:22   ` [PATCH 4/5] arm/dt: mx5: change timer init function to dt clock way Shawn Guo
2011-03-07 16:22   ` [PATCH 5/5] of/clock: eliminate function __of_clk_get_from_provider Shawn Guo

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=20110315080256.GM23050@angua.secretlab.ca \
    --to=grant.likely-s3s/wqlpoipyb63q8fvjnq@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=linaro-dev-cunTk1MwBs8s++Sfvej+rw@public.gmane.org \
    --cc=patches-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=shawn.guo-KZfg59tc24xl57MIdRCFDg@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).