clk: add common of_clk_init() function
Modify of_clk_init function so that it will determine which driver to initialize based on device tree instead of each driver registering to it. Based on a similar patch for drivers/irqchip by Thomas Petazzoni and drivers/clocksource by Stephen Warren. Signed-off-by: Prashant Gaikwad <pgaikwad@nvidia.com> Tested-by: Tony Prisk <linux@prisktech.co.nz> Tested-by: Pawel Moll <pawel.moll@arm.com> Tested-by: Rob Herring <rob.herring@calxeda.com> Tested-by: Josh Cartwright <josh.cartwright@ni.com> Reviewed-by: Josh Cartwright <josh.cartwright@ni.com> Acked-by: Maxime Ripard <maxime.ripard@anandra.org> Signed-off-by: Mike Turquette <mturquette@linaro.org> [mturquette@linaro.org: merge conflict from missing CLKSRC_OF_TABLES()] Signed-off-by: Mike Turquette <mturquette@linaro.org>
This commit is contained in:

committed by
Mike Turquette

parent
4cfe54e579
commit
f2f6c2556d
@@ -18,6 +18,7 @@
|
||||
#include <linux/slab.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
static DEFINE_SPINLOCK(enable_lock);
|
||||
static DEFINE_MUTEX(prepare_lock);
|
||||
@@ -1803,6 +1804,11 @@ struct of_clk_provider {
|
||||
void *data;
|
||||
};
|
||||
|
||||
extern struct of_device_id __clk_of_table[];
|
||||
|
||||
static const struct of_device_id __clk_of_table_sentinel
|
||||
__used __section(__clk_of_table_end);
|
||||
|
||||
static LIST_HEAD(of_clk_providers);
|
||||
static DEFINE_MUTEX(of_clk_lock);
|
||||
|
||||
@@ -1931,6 +1937,9 @@ void __init of_clk_init(const struct of_device_id *matches)
|
||||
{
|
||||
struct device_node *np;
|
||||
|
||||
if (!matches)
|
||||
matches = __clk_of_table;
|
||||
|
||||
for_each_matching_node(np, matches) {
|
||||
const struct of_device_id *match = of_match_node(matches, np);
|
||||
of_clk_init_cb_t clk_init_cb = match->data;
|
||||
|
Reference in New Issue
Block a user