[PATCH 02/23] clk clkdev: Add clkdev matching based on physbase

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Wed Sep 26 15:09:18 EDT 2012


On 20:53 Wed 26 Sep     , Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 19:25 Wed 26 Sep     , Sascha Hauer wrote:
> > On Wed, Sep 26, 2012 at 06:02:39PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > On 13:04 Mon 24 Sep     , Sascha Hauer wrote:
> > > > Most clock/device associations can be done based on the physical
> > > > base address of the corresponding device. So instead of depending
> > > > on string matching add an optional possibility to associate a clock
> > > > lookups with physical addresses. This also has the advantage that
> > > > the lookups for devicetree based devices can be identical to the
> > > > platform based devices.
> > > > 
> > > > Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> > > > ---
> > > >  drivers/clk/clkdev.c   |   47 +++++++++++++++++++++++++++++++++++++++++++++++
> > > >  include/linux/clkdev.h |    3 +++
> > > >  2 files changed, 50 insertions(+)
> > > > 
> > > > diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
> > > > index 717fea5..40bc006 100644
> > > > --- a/drivers/clk/clkdev.c
> > > > +++ b/drivers/clk/clkdev.c
> > > > @@ -62,6 +62,32 @@ static struct clk *clk_find(const char *dev_id, const char *con_id)
> > > >  	return clk;
> > > >  }
> > > >  
> > > > +static struct clk *clk_find_physbase(struct device_d *dev, const char *con_id)
> > > > +{
> > > > +	struct clk_lookup *p;
> > > > +	unsigned long start;
> > > > +
> > > > +	if (!dev || !dev->resource)
> > > > +		return ERR_PTR(-ENOSYS);
> > > this is broken
> > > 
> > > clk_get_sys(NULL, "toto") is a valid call
> > 
> > clk_get_sys never calls clk_find_physbase. clk_get(NULL, "toto") will
> > call clk_find_physbase in which case clk_find_physbase returns -ENOSYS
> > and clk_get falls back to clk_get_sys just as it did before.
> it's clk_get (NULL, "toto)
> 
> that fail which is basilcally used on at91
> 
> and a device without resources cannot get it's clock
ignore this

Best Regards,
J.



More information about the barebox mailing list