Re: [PATCH v3 4/5] clk: basic gateable and fixed-rate clks

From: Andrew Lunn
Date: Mon Dec 12 2011 - 15:08:04 EST


Hi Mike

+int clk_register_gate(struct device *dev, const char *name, unsigned long flags,
+ struct clk *fixed_parent, void __iomem *reg, u8 bit_idx,
+ int set_to_enable)
+

How do you suggest handling gated clocks which are already running
when calling the register function?

On my kirkwood bases system, the bootloader has already turned on a
number of clocks. It does not seem right to start messing with
clk->enable_count and clk->prepare_count. Could clk_register_gate()
have one more parameter, a bool indicating running?

The kirkwood mach code keeps a bitmap of which platform_data init
functions are called from the board file. In a late_initcall function
it then enables and disables clocks as needed. What i was thinking is
i can ask the hardware what clocks are already running before i
register them and register them as running/not running. Then let the
driver probe functions use the API to enable clocks which are really
needed. In a late_initcall function, i would then call clk_disable(),
clk_unprepare() on clocks which the boot loader started, thus turning
them off if no driver has claimed them.

Is this how you envisage it working?

Thanks
Andrew
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/