interconnect: Allow endpoints translation via DT

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.

Reviewed-by: Evan Green <evgreen@chromium.org>
Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Georgi Djakov 2019-01-16 18:10:58 +02:00 committed by Greg Kroah-Hartman
parent 06b3773b50
commit 87e3031b6f
3 changed files with 173 additions and 0 deletions

View file

@ -12,6 +12,21 @@
#define icc_units_to_bps(bw) ((bw) * 1000ULL)
struct icc_node;
struct of_phandle_args;
/**
* struct icc_onecell_data - driver data for onecell interconnect providers
*
* @num_nodes: number of nodes in this device
* @nodes: array of pointers to the nodes in this device
*/
struct icc_onecell_data {
unsigned int num_nodes;
struct icc_node *nodes[];
};
struct icc_node *of_icc_xlate_onecell(struct of_phandle_args *spec,
void *data);
/**
* struct icc_provider - interconnect provider (controller) entity that might
@ -21,6 +36,7 @@ struct icc_node;
* @nodes: internal list of the interconnect provider nodes
* @set: pointer to device specific set operation function
* @aggregate: pointer to device specific aggregate operation function
* @xlate: provider-specific callback for mapping nodes from phandle arguments
* @dev: the device this interconnect provider belongs to
* @users: count of active users
* @data: pointer to private data
@ -31,6 +47,7 @@ struct icc_provider {
int (*set)(struct icc_node *src, struct icc_node *dst);
int (*aggregate)(struct icc_node *node, u32 avg_bw, u32 peak_bw,
u32 *agg_avg, u32 *agg_peak);
struct icc_node* (*xlate)(struct of_phandle_args *spec, void *data);
struct device *dev;
int users;
void *data;

View file

@ -27,6 +27,7 @@ struct device;
struct icc_path *icc_get(struct device *dev, const int src_id,
const int dst_id);
struct icc_path *of_icc_get(struct device *dev, const char *name);
void icc_put(struct icc_path *path);
int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw);
@ -38,6 +39,12 @@ static inline struct icc_path *icc_get(struct device *dev, const int src_id,
return NULL;
}
static inline struct icc_path *of_icc_get(struct device *dev,
const char *name)
{
return NULL;
}
static inline void icc_put(struct icc_path *path)
{
}