Mike Turquette | b2476490 | 2012-03-15 23:11:19 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * linux/include/linux/clk-private.h |
| 3 | * |
| 4 | * Copyright (c) 2010-2011 Jeremy Kerr <jeremy.kerr@canonical.com> |
| 5 | * Copyright (C) 2011-2012 Linaro Ltd <mturquette@linaro.org> |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | * published by the Free Software Foundation. |
| 10 | */ |
| 11 | #ifndef __LINUX_CLK_PRIVATE_H |
| 12 | #define __LINUX_CLK_PRIVATE_H |
| 13 | |
| 14 | #include <linux/clk-provider.h> |
| 15 | #include <linux/list.h> |
| 16 | |
| 17 | /* |
| 18 | * WARNING: Do not include clk-private.h from any file that implements struct |
| 19 | * clk_ops. Doing so is a layering violation! |
| 20 | * |
| 21 | * This header exists only to allow for statically initialized clock data. Any |
| 22 | * static clock data must be defined in a separate file from the logic that |
| 23 | * implements the clock operations for that same data. |
| 24 | */ |
| 25 | |
| 26 | #ifdef CONFIG_COMMON_CLK |
| 27 | |
| 28 | struct clk { |
| 29 | const char *name; |
| 30 | const struct clk_ops *ops; |
| 31 | struct clk_hw *hw; |
| 32 | struct clk *parent; |
| 33 | char **parent_names; |
| 34 | struct clk **parents; |
| 35 | u8 num_parents; |
| 36 | unsigned long rate; |
| 37 | unsigned long new_rate; |
| 38 | unsigned long flags; |
| 39 | unsigned int enable_count; |
| 40 | unsigned int prepare_count; |
| 41 | struct hlist_head children; |
| 42 | struct hlist_node child_node; |
| 43 | unsigned int notifier_count; |
| 44 | #ifdef CONFIG_COMMON_CLK_DEBUG |
| 45 | struct dentry *dentry; |
| 46 | #endif |
| 47 | }; |
| 48 | |
| 49 | /** |
| 50 | * __clk_init - initialize the data structures in a struct clk |
| 51 | * @dev: device initializing this clk, placeholder for now |
| 52 | * @clk: clk being initialized |
| 53 | * |
| 54 | * Initializes the lists in struct clk, queries the hardware for the |
| 55 | * parent and rate and sets them both. |
| 56 | * |
| 57 | * Any struct clk passed into __clk_init must have the following members |
| 58 | * populated: |
| 59 | * .name |
| 60 | * .ops |
| 61 | * .hw |
| 62 | * .parent_names |
| 63 | * .num_parents |
| 64 | * .flags |
| 65 | * |
| 66 | * It is not necessary to call clk_register if __clk_init is used directly with |
| 67 | * statically initialized clock data. |
| 68 | */ |
| 69 | void __clk_init(struct device *dev, struct clk *clk); |
| 70 | |
| 71 | #endif /* CONFIG_COMMON_CLK */ |
| 72 | #endif /* CLK_PRIVATE_H */ |