diff options
| author | Stephen Boyd <sboyd@kernel.org> | 2019-05-07 14:46:13 -0400 |
|---|---|---|
| committer | Stephen Boyd <sboyd@kernel.org> | 2019-05-07 14:46:13 -0400 |
| commit | c1157f60d72e8b20efc670cef28883832f42406c (patch) | |
| tree | e12b4aa8986f184cbf5a92a1816c210c23fdbbc9 /include/linux | |
| parent | 0caf000817353cfc5db22363ecdac63b83d3a3f9 (diff) | |
| parent | 1a079560b1450b72ff4e944bb9185e77633d74c4 (diff) | |
Merge branch 'clk-parent-rewrite-1' into clk-next
- Rewrite how clk parents can be specified to be DT/clkdev based instead
of just string based
* clk-parent-rewrite-1:
clk: Cache core in clk_fetch_parent_index() without names
clk: fixed-factor: Initialize clk_init_data on stack
clk: fixed-factor: Let clk framework find parent
clk: Allow parents to be specified via clkspec index
clk: Look for parents with clkdev based clk_lookups
clk: Allow parents to be specified without string names
clk: Add of_clk_hw_register() API for early clk drivers
driver core: Let dev_of_node() accept a NULL dev
clk: Prepare for clk registration API that uses DT nodes
clkdev: Move clk creation outside of 'clocks_mutex'
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/clk-provider.h | 22 | ||||
| -rw-r--r-- | include/linux/device.h | 2 |
2 files changed, 23 insertions, 1 deletions
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 8fa494aaa34d..491d992d045d 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h | |||
| @@ -251,19 +251,40 @@ struct clk_ops { | |||
| 251 | }; | 251 | }; |
| 252 | 252 | ||
| 253 | /** | 253 | /** |
| 254 | * struct clk_parent_data - clk parent information | ||
| 255 | * @hw: parent clk_hw pointer (used for clk providers with internal clks) | ||
| 256 | * @fw_name: parent name local to provider registering clk | ||
| 257 | * @name: globally unique parent name (used as a fallback) | ||
| 258 | * @index: parent index local to provider registering clk (if @fw_name absent) | ||
| 259 | */ | ||
| 260 | struct clk_parent_data { | ||
| 261 | const struct clk_hw *hw; | ||
| 262 | const char *fw_name; | ||
| 263 | const char *name; | ||
| 264 | int index; | ||
| 265 | }; | ||
| 266 | |||
| 267 | /** | ||
| 254 | * struct clk_init_data - holds init data that's common to all clocks and is | 268 | * struct clk_init_data - holds init data that's common to all clocks and is |
| 255 | * shared between the clock provider and the common clock framework. | 269 | * shared between the clock provider and the common clock framework. |
| 256 | * | 270 | * |
| 257 | * @name: clock name | 271 | * @name: clock name |
| 258 | * @ops: operations this clock supports | 272 | * @ops: operations this clock supports |
| 259 | * @parent_names: array of string names for all possible parents | 273 | * @parent_names: array of string names for all possible parents |
| 274 | * @parent_data: array of parent data for all possible parents (when some | ||
| 275 | * parents are external to the clk controller) | ||
| 276 | * @parent_hws: array of pointers to all possible parents (when all parents | ||
| 277 | * are internal to the clk controller) | ||
| 260 | * @num_parents: number of possible parents | 278 | * @num_parents: number of possible parents |
| 261 | * @flags: framework-level hints and quirks | 279 | * @flags: framework-level hints and quirks |
| 262 | */ | 280 | */ |
| 263 | struct clk_init_data { | 281 | struct clk_init_data { |
| 264 | const char *name; | 282 | const char *name; |
| 265 | const struct clk_ops *ops; | 283 | const struct clk_ops *ops; |
| 284 | /* Only one of the following three should be assigned */ | ||
| 266 | const char * const *parent_names; | 285 | const char * const *parent_names; |
| 286 | const struct clk_parent_data *parent_data; | ||
| 287 | const struct clk_hw **parent_hws; | ||
| 267 | u8 num_parents; | 288 | u8 num_parents; |
| 268 | unsigned long flags; | 289 | unsigned long flags; |
| 269 | }; | 290 | }; |
| @@ -776,6 +797,7 @@ struct clk *devm_clk_register(struct device *dev, struct clk_hw *hw); | |||
| 776 | 797 | ||
| 777 | int __must_check clk_hw_register(struct device *dev, struct clk_hw *hw); | 798 | int __must_check clk_hw_register(struct device *dev, struct clk_hw *hw); |
| 778 | int __must_check devm_clk_hw_register(struct device *dev, struct clk_hw *hw); | 799 | int __must_check devm_clk_hw_register(struct device *dev, struct clk_hw *hw); |
| 800 | int __must_check of_clk_hw_register(struct device_node *node, struct clk_hw *hw); | ||
| 779 | 801 | ||
| 780 | void clk_unregister(struct clk *clk); | 802 | void clk_unregister(struct clk *clk); |
| 781 | void devm_clk_unregister(struct device *dev, struct clk *clk); | 803 | void devm_clk_unregister(struct device *dev, struct clk *clk); |
diff --git a/include/linux/device.h b/include/linux/device.h index 4e6987e11f68..ad626df2e12e 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -1229,7 +1229,7 @@ static inline void device_lock_assert(struct device *dev) | |||
| 1229 | 1229 | ||
| 1230 | static inline struct device_node *dev_of_node(struct device *dev) | 1230 | static inline struct device_node *dev_of_node(struct device *dev) |
| 1231 | { | 1231 | { |
| 1232 | if (!IS_ENABLED(CONFIG_OF)) | 1232 | if (!IS_ENABLED(CONFIG_OF) || !dev) |
| 1233 | return NULL; | 1233 | return NULL; |
| 1234 | return dev->of_node; | 1234 | return dev->of_node; |
| 1235 | } | 1235 | } |
