Commit b77e3ed0 authored by Suzuki K Poulose's avatar Suzuki K Poulose Committed by Greg Kroah-Hartman

coresight: Reuse platform data structure for connection tracking

The platform specific information describes the connections and
the ports of a given coresigh device. This information is also
recorded in the coresight device as separate fields. Let us reuse
the original platform description to streamline the handling
of the data.
Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d2998dc1
...@@ -756,8 +756,8 @@ tmc_etr_get_catu_device(struct tmc_drvdata *drvdata) ...@@ -756,8 +756,8 @@ tmc_etr_get_catu_device(struct tmc_drvdata *drvdata)
if (!IS_ENABLED(CONFIG_CORESIGHT_CATU)) if (!IS_ENABLED(CONFIG_CORESIGHT_CATU))
return NULL; return NULL;
for (i = 0; i < etr->nr_outport; i++) { for (i = 0; i < etr->pdata->nr_outport; i++) {
tmp = etr->conns[i].child_dev; tmp = etr->pdata->conns[i].child_dev;
if (tmp && coresight_is_catu_device(tmp)) if (tmp && coresight_is_catu_device(tmp))
return tmp; return tmp;
} }
......
...@@ -100,8 +100,8 @@ static int coresight_find_link_inport(struct coresight_device *csdev, ...@@ -100,8 +100,8 @@ static int coresight_find_link_inport(struct coresight_device *csdev,
int i; int i;
struct coresight_connection *conn; struct coresight_connection *conn;
for (i = 0; i < parent->nr_outport; i++) { for (i = 0; i < parent->pdata->nr_outport; i++) {
conn = &parent->conns[i]; conn = &parent->pdata->conns[i];
if (conn->child_dev == csdev) if (conn->child_dev == csdev)
return conn->child_port; return conn->child_port;
} }
...@@ -118,8 +118,8 @@ static int coresight_find_link_outport(struct coresight_device *csdev, ...@@ -118,8 +118,8 @@ static int coresight_find_link_outport(struct coresight_device *csdev,
int i; int i;
struct coresight_connection *conn; struct coresight_connection *conn;
for (i = 0; i < csdev->nr_outport; i++) { for (i = 0; i < csdev->pdata->nr_outport; i++) {
conn = &csdev->conns[i]; conn = &csdev->pdata->conns[i];
if (conn->child_dev == child) if (conn->child_dev == child)
return conn->outport; return conn->outport;
} }
...@@ -306,10 +306,10 @@ static void coresight_disable_link(struct coresight_device *csdev, ...@@ -306,10 +306,10 @@ static void coresight_disable_link(struct coresight_device *csdev,
if (link_subtype == CORESIGHT_DEV_SUBTYPE_LINK_MERG) { if (link_subtype == CORESIGHT_DEV_SUBTYPE_LINK_MERG) {
refport = inport; refport = inport;
nr_conns = csdev->nr_inport; nr_conns = csdev->pdata->nr_inport;
} else if (link_subtype == CORESIGHT_DEV_SUBTYPE_LINK_SPLIT) { } else if (link_subtype == CORESIGHT_DEV_SUBTYPE_LINK_SPLIT) {
refport = outport; refport = outport;
nr_conns = csdev->nr_outport; nr_conns = csdev->pdata->nr_outport;
} else { } else {
refport = 0; refport = 0;
nr_conns = 1; nr_conns = 1;
...@@ -595,9 +595,10 @@ static void coresight_grab_device(struct coresight_device *csdev) ...@@ -595,9 +595,10 @@ static void coresight_grab_device(struct coresight_device *csdev)
{ {
int i; int i;
for (i = 0; i < csdev->nr_outport; i++) { for (i = 0; i < csdev->pdata->nr_outport; i++) {
struct coresight_device *child = csdev->conns[i].child_dev; struct coresight_device *child;
child = csdev->pdata->conns[i].child_dev;
if (child && child->type == CORESIGHT_DEV_TYPE_HELPER) if (child && child->type == CORESIGHT_DEV_TYPE_HELPER)
pm_runtime_get_sync(child->dev.parent); pm_runtime_get_sync(child->dev.parent);
} }
...@@ -613,9 +614,10 @@ static void coresight_drop_device(struct coresight_device *csdev) ...@@ -613,9 +614,10 @@ static void coresight_drop_device(struct coresight_device *csdev)
int i; int i;
pm_runtime_put(csdev->dev.parent); pm_runtime_put(csdev->dev.parent);
for (i = 0; i < csdev->nr_outport; i++) { for (i = 0; i < csdev->pdata->nr_outport; i++) {
struct coresight_device *child = csdev->conns[i].child_dev; struct coresight_device *child;
child = csdev->pdata->conns[i].child_dev;
if (child && child->type == CORESIGHT_DEV_TYPE_HELPER) if (child && child->type == CORESIGHT_DEV_TYPE_HELPER)
pm_runtime_put(child->dev.parent); pm_runtime_put(child->dev.parent);
} }
...@@ -645,9 +647,10 @@ static int _coresight_build_path(struct coresight_device *csdev, ...@@ -645,9 +647,10 @@ static int _coresight_build_path(struct coresight_device *csdev,
goto out; goto out;
/* Not a sink - recursively explore each port found on this element */ /* Not a sink - recursively explore each port found on this element */
for (i = 0; i < csdev->nr_outport; i++) { for (i = 0; i < csdev->pdata->nr_outport; i++) {
struct coresight_device *child_dev = csdev->conns[i].child_dev; struct coresight_device *child_dev;
child_dev = csdev->pdata->conns[i].child_dev;
if (child_dev && if (child_dev &&
_coresight_build_path(child_dev, sink, path) == 0) { _coresight_build_path(child_dev, sink, path) == 0) {
found = true; found = true;
...@@ -1000,8 +1003,8 @@ static int coresight_orphan_match(struct device *dev, void *data) ...@@ -1000,8 +1003,8 @@ static int coresight_orphan_match(struct device *dev, void *data)
* Circle throuch all the connection of that component. If we find * Circle throuch all the connection of that component. If we find
* an orphan connection whose name matches @csdev, link it. * an orphan connection whose name matches @csdev, link it.
*/ */
for (i = 0; i < i_csdev->nr_outport; i++) { for (i = 0; i < i_csdev->pdata->nr_outport; i++) {
conn = &i_csdev->conns[i]; conn = &i_csdev->pdata->conns[i];
/* We have found at least one orphan connection */ /* We have found at least one orphan connection */
if (conn->child_dev == NULL) { if (conn->child_dev == NULL) {
...@@ -1040,8 +1043,8 @@ static void coresight_fixup_device_conns(struct coresight_device *csdev) ...@@ -1040,8 +1043,8 @@ static void coresight_fixup_device_conns(struct coresight_device *csdev)
{ {
int i; int i;
for (i = 0; i < csdev->nr_outport; i++) { for (i = 0; i < csdev->pdata->nr_outport; i++) {
struct coresight_connection *conn = &csdev->conns[i]; struct coresight_connection *conn = &csdev->pdata->conns[i];
struct device *dev = NULL; struct device *dev = NULL;
if (conn->child_name) if (conn->child_name)
...@@ -1075,8 +1078,8 @@ static int coresight_remove_match(struct device *dev, void *data) ...@@ -1075,8 +1078,8 @@ static int coresight_remove_match(struct device *dev, void *data)
* Circle throuch all the connection of that component. If we find * Circle throuch all the connection of that component. If we find
* a connection whose name matches @csdev, remove it. * a connection whose name matches @csdev, remove it.
*/ */
for (i = 0; i < iterator->nr_outport; i++) { for (i = 0; i < iterator->pdata->nr_outport; i++) {
conn = &iterator->conns[i]; conn = &iterator->pdata->conns[i];
if (conn->child_dev == NULL) if (conn->child_dev == NULL)
continue; continue;
...@@ -1108,7 +1111,7 @@ static void coresight_remove_conns(struct coresight_device *csdev) ...@@ -1108,7 +1111,7 @@ static void coresight_remove_conns(struct coresight_device *csdev)
* doesn't have at least one input port, there is no point * doesn't have at least one input port, there is no point
* in searching all the devices. * in searching all the devices.
*/ */
if (csdev->nr_inport) if (csdev->pdata->nr_inport)
bus_for_each_dev(&coresight_bustype, NULL, bus_for_each_dev(&coresight_bustype, NULL,
csdev, coresight_remove_match); csdev, coresight_remove_match);
} }
...@@ -1195,10 +1198,7 @@ struct coresight_device *coresight_register(struct coresight_desc *desc) ...@@ -1195,10 +1198,7 @@ struct coresight_device *coresight_register(struct coresight_desc *desc)
csdev->refcnt = refcnts; csdev->refcnt = refcnts;
csdev->nr_inport = desc->pdata->nr_inport; csdev->pdata = desc->pdata;
csdev->nr_outport = desc->pdata->nr_outport;
csdev->conns = desc->pdata->conns;
csdev->type = desc->type; csdev->type = desc->type;
csdev->subtype = desc->subtype; csdev->subtype = desc->subtype;
......
...@@ -140,9 +140,7 @@ struct coresight_connection { ...@@ -140,9 +140,7 @@ struct coresight_connection {
/** /**
* struct coresight_device - representation of a device as used by the framework * struct coresight_device - representation of a device as used by the framework
* @conns: array of coresight_connections associated to this component. * @pdata: Platform data with device connections associated to this device.
* @nr_inport: number of input port associated to this component.
* @nr_outport: number of output port associated to this component.
* @type: as defined by @coresight_dev_type. * @type: as defined by @coresight_dev_type.
* @subtype: as defined by @coresight_dev_subtype. * @subtype: as defined by @coresight_dev_subtype.
* @ops: generic operations for this component, as defined * @ops: generic operations for this component, as defined
...@@ -157,9 +155,7 @@ struct coresight_connection { ...@@ -157,9 +155,7 @@ struct coresight_connection {
* @ea: Device attribute for sink representation under PMU directory. * @ea: Device attribute for sink representation under PMU directory.
*/ */
struct coresight_device { struct coresight_device {
struct coresight_connection *conns; struct coresight_platform_data *pdata;
int nr_inport;
int nr_outport;
enum coresight_dev_type type; enum coresight_dev_type type;
union coresight_dev_subtype subtype; union coresight_dev_subtype subtype;
const struct coresight_ops *ops; const struct coresight_ops *ops;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment