[PATCH 3/5] arm/dt: mx51: dynamically add clocks per dt nodes

Shawn Guo shawn.guo at freescale.com
Wed Mar 16 14:08:48 UTC 2011


On Tue, Mar 15, 2011 at 01:48:08AM -0600, Grant Likely wrote:
> On Mon, Mar 14, 2011 at 09:18:40PM +0800, Shawn Guo wrote:
> > This patch is to change the static clock creating and registering to
> > the dynamic way, which scans dt clock nodes, associate clk with
> > device_node, and then add them to clkdev accordingly.
> > 
> > It's a pretty straight translation from non-dt clock code to dt one,
> > and it does not really change any actual clock code.
> > 
> > Signed-off-by: Shawn Guo <shawn.guo at linaro.org>
> > ---
> >  arch/arm/mach-mx5/clock-mx51-mx53.c | 1401 ++++++++++++++++++++++++++++++++++-
> >  1 files changed, 1387 insertions(+), 14 deletions(-)
> > 
> > diff --git a/arch/arm/mach-mx5/clock-mx51-mx53.c b/arch/arm/mach-mx5/clock-mx51-mx53.c
> > index dedb7f9..c3ec7f6 100644
> > --- a/arch/arm/mach-mx5/clock-mx51-mx53.c
> > +++ b/arch/arm/mach-mx5/clock-mx51-mx53.c
> > @@ -49,6 +49,30 @@ static struct clk emi_fast_clk;
> >  static struct clk ipu_clk;
> >  static struct clk mipi_hsc1_clk;
> >  
> > +#ifdef CONFIG_OF
> > +/*
> > + * The pointers are defined to save the references to the clocks
> > + * dynamically created, and then could be used to replace those
> > + * static references in non-dt clock code.
> > + */
> > +static struct clk *osc_clk_dt;
> > +static struct clk *pll1_main_clk_dt;
> > +static struct clk *pll1_sw_clk_dt;
> > +static struct clk *pll2_sw_clk_dt;
> > +static struct clk *pll3_sw_clk_dt;
> > +static struct clk *lp_apm_clk_dt;
> > +static struct clk *periph_apm_clk_dt;
> > +static struct clk *main_bus_clk_dt;
> > +static struct clk *ipg_clk_dt;
> > +static struct clk *ipg_per_clk_dt;
> > +static struct clk *cpu_clk_dt;
> > +static struct clk *iim_clk_dt;
> > +static struct clk *usboh3_clk_dt;
> > +static struct clk *usb_phy1_clk_dt;
> > +static struct clk *esdhc1_clk_dt;
> > +static struct clk *esdhc2_clk_dt;
> > +#endif
> 
> Heh, yeah this seems sub-optimal.  It would be better to share common
> clock initialization between dt and non-dt boards, even if it means
> that a lot of the clocks are node described in the device tree (at
> least for the on-chip SoC clocks; board-accessible clocks still need
> to appear in the device tree though.
> 
I do not understand the above comment.  These are not statically
defining 'struct clk' but the pointers to them.  They are used to
solve the references to static 'clk' in existing code, since all clk
are created dynamically in dt code.

-- 
Regards,
Shawn




More information about the linaro-dev mailing list