-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3822989
commit c646552
Showing
2 changed files
with
171 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Starting from DTS point: | ||
|
||
CLK_OF_DECLARE(at91rm9200_clk_main_osc, "atmel,at91rm9200-clk-main-osc", | ||
of_at91rm9200_clk_main_osc_setup); | ||
|
||
|
||
of_at91sam9260_clk_slow_setup() | ||
- at91_clk_register_sam9260_slow(regmap, name, parent_name, bypass); slowck+clk_hw is born! | ||
- clk_hw_register(NULL, slowck->hw); | ||
- clk_register(dev, hw) returns clk* clk_core is born! | ||
- INIT_HLIST_HEAD(&core->clks); create clk list for core? | ||
- __clk_create_clk(hw, NULL, NULL); clk is born! | ||
- hlist_add_head(&clk->clks_node, &hw->core->clks); clk is added as a node to the hlist core->clks | ||
- __clk_core_init(core); | ||
- of_clk_add_hw_provider(np, of_clk_hw_simple_get, hw); of_clk_provider is born! But we never see the message! | ||
|
||
|
||
|
||
|
||
__clk_create_clk creates clk from clk_hw (in memory) | ||
|
||
|
||
struct clk *__clk_create_clk(struct clk_hw *hw, const char *dev_id, | ||
const char *con_id) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
Clock hlists: | ||
|
||
|
||
static struct hlist_head *all_lists[] = { | ||
&clk_root_list, | ||
&clk_orphan_list, | ||
NULL, | ||
}; | ||
|
||
of_clk_providers ? | ||
|
||
|
||
|
||
|
||
|
||
clk points to clk_core | ||
|
||
clk_core point to clk_hw | ||
|
||
clk_hw points to clk_core and clk | ||
|
||
|
||
=============================== | ||
|
||
struct clk_core { | ||
const char *name; | ||
const struct clk_ops *ops; | ||
struct clk_hw *hw; | ||
struct module *owner; | ||
struct device *dev; | ||
struct clk_core *parent; | ||
const char **parent_names; | ||
struct clk_core **parents; | ||
u8 num_parents; | ||
u8 new_parent_index; | ||
unsigned long rate; | ||
unsigned long req_rate; | ||
unsigned long new_rate; | ||
struct clk_core *new_parent; | ||
struct clk_core *new_child; | ||
unsigned long flags; | ||
bool orphan; | ||
unsigned int enable_count; | ||
unsigned int prepare_count; | ||
unsigned int protect_count; | ||
unsigned long min_rate; | ||
unsigned long max_rate; | ||
unsigned long accuracy; | ||
int phase; | ||
struct clk_duty duty; | ||
struct hlist_head children; | ||
struct hlist_node child_node; | ||
struct hlist_head clks; | ||
unsigned int notifier_count; | ||
#ifdef CONFIG_DEBUG_FS | ||
struct dentry *dentry; | ||
struct hlist_node debug_node; | ||
#endif | ||
struct kref ref; | ||
}; | ||
|
||
============================= | ||
clk includes clk_core | ||
|
||
struct clk { | ||
struct clk_core *core; | ||
const char *dev_id; | ||
const char *con_id; | ||
unsigned long min_rate; | ||
unsigned long max_rate; | ||
unsigned int exclusive_count; | ||
struct hlist_node clks_node; | ||
}; | ||
============================= | ||
Points to both parents clk and clk_core | ||
points to clk_init_data which is reset to NULL once clk_register() is called on it. | ||
|
||
/** | ||
* struct clk_hw - handle for traversing from a struct clk to its corresponding | ||
* hardware-specific structure. struct clk_hw should be declared within struct | ||
* clk_foo and then referenced by the struct clk instance that uses struct | ||
* clk_foo's clk_ops | ||
* | ||
* @core: pointer to the struct clk_core instance that points back to this | ||
* struct clk_hw instance | ||
* | ||
* @clk: pointer to the per-user struct clk instance that can be used to call | ||
* into the clk API | ||
* | ||
* @init: pointer to struct clk_init_data that contains the init data shared | ||
* with the common clock framework. This pointer will be set to NULL once | ||
* a clk_register() variant is called on this clk_hw pointer. | ||
*/ | ||
|
||
struct clk_hw { | ||
struct clk_core *core; | ||
struct clk *clk; | ||
const struct clk_init_data *init; | ||
}; | ||
============================= | ||
|
||
/** | ||
* struct clk_init_data - holds init data that's common to all clocks and is | ||
* shared between the clock provider and the common clock framework. | ||
* | ||
* @name: clock name | ||
* @ops: operations this clock supports | ||
* @parent_names: array of string names for all possible parents | ||
* @num_parents: number of possible parents | ||
* @flags: framework-level hints and quirks | ||
*/ | ||
struct clk_init_data { | ||
const char *name; | ||
const struct clk_ops *ops; | ||
const char * const *parent_names; | ||
u8 num_parents; | ||
unsigned long flags; | ||
}; | ||
============================= | ||
struct clk_sam9260_slow { | ||
struct clk_hw hw; | ||
struct regmap *regmap; | ||
}; | ||
============================= | ||
/** | ||
* struct of_clk_provider - Clock provider registration structure | ||
* @link: Entry in global list of clock providers | ||
* @node: Pointer to device tree node of clock provider | ||
* @get: Get clock callback. Returns NULL or a struct clk for the | ||
* given clock specifier | ||
* @data: context pointer to be passed into @get callback | ||
*/ | ||
struct of_clk_provider { | ||
struct list_head link; | ||
|
||
struct device_node *node; | ||
struct clk *(*get)(struct of_phandle_args *clkspec, void *data); | ||
struct clk_hw *(*get_hw)(struct of_phandle_args *clkspec, void *data); | ||
void *data; | ||
}; | ||
|
||
static LIST_HEAD(of_clk_providers); | ||
=========================== | ||
|
||
|