[PATCH v8 3/6] OMAP2430: hwmod data: Add watchdog timer

Paul Walmsley paul at pwsan.com
Thu Sep 23 13:07:33 EDT 2010


Hello Russell,

On Thu, 23 Sep 2010, Russell King - ARM Linux wrote:

> On Thu, Sep 23, 2010 at 08:02:40PM +0530, Varadarajan, Charulatha wrote:
> > +static struct omap_hwmod omap2430_wd_timer2_hwmod = {
> > +	.name		= "wd_timer2",
> > +	.class		= &omap2430_wd_timer_hwmod_class,
> > +	.main_clk	= "mpu_wdt_fck",
> 
> Why are we going backwards to naming clocks by source rather than
> looking them up by device + connection ?

(Device, connection) clock addressing is still used by device drivers.  
It is a superior method for drivers, and one that's not going anywhere. 
Drivers still should do:

    c = clk_get(dev, "fck");

... if it needs to work with clocks directly.  [ Most drivers won't even 
need to do this now, unless they wish to change clock sources or rates, 
since pm_runtime_{get,put}() will automatically enable/disable clocks on 
OMAP. ]

The OMAP clock code still uses clkdev to map (device, connection name) to 
the appropriate struct clk.  The utility of that dual naming is not in 
question.  For driver code, that clock naming scheme is crucial to having 
drivers that can work across multiple SoCs without modification.

The hwmod data, however, describes the hardware at a fundamental level: 
one that is independent of the Linux driver model.  Like the OMAP struct 
clks, clockdomains, and powerdomains, this data is intended to be 
autogenerated from the TI hardware database.  This is data that, in an 
ideal world, would be in ROM somewhere on the OMAP: ideally it should 
never change across the life of the device.  For the OMAP core code that 
uses this data, it doesn't care whether there is a platform_device above 
it, an of_device, or an omap_device, or whether someone has just written a 
new driver that groups devices differently.  This hwmod data describes the 
hardware itself and is used for basic IP block control: to reset, 
initialize, enable, idle, and disable on-chip IP blocks.  Much of this 
happens very early in boot, before the Linux driver model code enumerates 
devices.

So the clock names used here are intended to be the TI hardware database 
clock names, which also appear in the OMAP struct clk.name.  The only 
place the hwmod clock names are used in the kernel is by the hwmod core 
code.  There is a core-internal function in the OMAP clock code used by 
the hwmod code to connect the autogenerated struct clks to the 
autogenerated hwmod data.  Any other part of the kernel that works with 
struct devices must use the (device, connection) naming scheme, via the 
clock code.


I appreciate the comments,

- Paul



More information about the linux-arm-kernel mailing list