Currently we support only platform data for specifying the interconnect endpoints. As now the endpoints are hard-coded into the consumer driver this may lead to complications when a single driver is used by multiple SoCs, which may have different interconnect topology. To avoid cluttering the consumer drivers, introduce a translation function to help us get the board specific interconnect data from device-tree.
Showing the changes to include/linux (2 of 3 files). Show all
Unified · Split
| @@ -12,6 +12,21 @@ · 11 unmodified lines | ||
| 12 | 12 | #define icc_units_to_bps(bw) ((bw) * 1000ULL) |
| 13 | 13 | |
| 14 | 14 | struct icc_node; |
| 15 | +struct of_phandle_args; | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * struct icc_onecell_data - driver data for onecell interconnect providers | |
| 19 | + * | |
| 20 | + * @num_nodes: number of nodes in this device | |
| 21 | + * @nodes: array of pointers to the nodes in this device | |
| 22 | + */ | |
| 23 | +struct icc_onecell_data { | |
| 24 | + unsigned int num_nodes; | |
| 25 | + struct icc_node *nodes[]; | |
| 26 | +}; | |
| 27 | + | |
| 28 | +struct icc_node *of_icc_xlate_onecell(struct of_phandle_args *spec, | |
| 29 | + void *data); | |
| 15 | 30 | |
| 16 | 31 | /** |
| 17 | 32 | * struct icc_provider - interconnect provider (controller) entity that might |
| @@ -21,6 +36,7 @@ struct icc_node; · 3 unmodified lines | ||
| 21 | 36 | * @nodes: internal list of the interconnect provider nodes |
| 22 | 37 | * @set: pointer to device specific set operation function |
| 23 | 38 | * @aggregate: pointer to device specific aggregate operation function |
| 39 | + * @xlate: provider-specific callback for mapping nodes from phandle arguments | |
| 24 | 40 | * @dev: the device this interconnect provider belongs to |
| 25 | 41 | * @users: count of active users |
| 26 | 42 | * @data: pointer to private data |
| @@ -31,6 +47,7 @@ struct icc_provider { · 4 unmodified lines | ||
| 31 | 47 | int (*set)(struct icc_node *src, struct icc_node *dst); |
| 32 | 48 | int (*aggregate)(struct icc_node *node, u32 avg_bw, u32 peak_bw, |
| 33 | 49 | u32 *agg_avg, u32 *agg_peak); |
| 50 | + struct icc_node* (*xlate)(struct of_phandle_args *spec, void *data); | |
| 34 | 51 | struct device *dev; |
| 35 | 52 | int users; |
| 36 | 53 | void *data; |
| @@ -27,6 +27,7 @@ struct device; · 26 unmodified lines | ||
| 27 | 27 | |
| 28 | 28 | struct icc_path *icc_get(struct device *dev, const int src_id, |
| 29 | 29 | const int dst_id); |
| 30 | +struct icc_path *of_icc_get(struct device *dev, const char *name); | |
| 30 | 31 | void icc_put(struct icc_path *path); |
| 31 | 32 | int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw); |
| 32 | 33 | |
| @@ -38,6 +39,12 @@ static inline struct icc_path *icc_get(struct device *dev, const int src_id, · 5 unmodified lines | ||
| 38 | 39 | return NULL; |
| 39 | 40 | } |
| 40 | 41 | |
| 42 | +static inline struct icc_path *of_icc_get(struct device *dev, | |
| 43 | + const char *name) | |
| 44 | +{ | |
| 45 | + return NULL; | |
| 46 | +} | |
| 47 | + | |
| 41 | 48 | static inline void icc_put(struct icc_path *path) |
| 42 | 49 | { |
| 43 | 50 | } |