[PATCH 5/6] Clk: SPEAr1340: fix sys clock parent source and corresponding mask value

Mike Turquette mturquette at ti.com
Wed Jul 11 16:11:36 EDT 2012


On 20120710-09:21, Viresh Kumar wrote:
> On 9 July 2012 23:57, Mike Turquette <mturquette at ti.com> wrote:
> 
> > I assume this change has been tested and wouldn't be posted if modifying
> > the parent names broke things.
> >
> > That said, as long as the parent names are valid strings then the clk
> > framework should handle them.  When calling __clk_lookup for parent name
> > "none", __clk_lookup will return NULL (of course assuming no one else in
> > the system registered a clock named "none", which would be silly).  This
> > is handled gracefully by the clk framework by re-parenting your "sys"
> > clk from $old_parent to the "orphan" list.
> >
> > At the top level, there are basically two clock trees.  The first tree
> > is "real" clock tree which starts as a list of clocks that set the
> > CLK_IS_ROOT flag.  The second tree is a tree of "orphans" for clocks
> > which are defined but "disconnected" from any real root clock (which
> > might be caused by missing data, etc).
> >
> > In general it is OK to declare parent names which might result in your
> > clock being orphaned.  In practice it is more likely that your data
> > matches your code: e.g. if you don't support a parent clock in the data
> > then you likely never try use that missing parent clock in your code.
> >
> > The OMAP port does in fact make use of the orphan tree for some clocks,
> > so it is tested.  However we haven't had any users of the clock tree
> > which made a lot of use of "dynamic" reparenting to and from the orphan
> > tree.  I did unit test this back during the 3.4 cycle, but I haven't
> > since.  Let me know if you have any problems with it.
> >
> 
> Hi Mike,
> 
> For example, clk1 have parents pclk1 and pclk2. Register values
> for pclk1 is 0X and for pclk2 is 1X. i.e. pclk1 is selected for both 00 and
> 01.
> And pclk2 is selected for 10 and 11. so, its better to take care of all
> these situations,
> otherwise there can be corner cases like: In linux we decide to use 00 for
> pclk1, 10 for
> pclk2 and other two for "none". But bootloader, enabled the clock with 01
> for pclk1.
> This clock isn't a orphan but it will look like that in our clock tree.
> 
> So, is this OK in the current implementation of clk framework to have
> parents like
> "pclk1", "pclk1", "pclk2", "pclk2"?
> 

Hello Viresh,

I believe it will be OK, but that situation definitely needs testing.
There will not be duplicate clocks in the tree (which is good), but the
parent selection logic for clk1 will be a bit silly.  All in all
duplicating parent string names is a hack.

If this case is very common then a better way to handle it would be a
clk_mux-specific flag which handles this case gracefully.  Mark all of
your mux data with this flag for the affected clocks and then don't
worry about it anymore.

Regards,
Mike

> --
> viresh



More information about the linux-arm-kernel mailing list