Merge "coresight: Fix support for sparsely populated ports"

This commit is contained in:
qctecmdr 2020-09-18 04:24:50 -07:00 committed by Gerrit - the friendly Code Review server
commit 14403b3a85
2 changed files with 10 additions and 2 deletions

View File

@ -1398,6 +1398,8 @@ struct coresight_device *coresight_register(struct coresight_desc *desc)
}
for (i = 0; i < csdev->nr_outport; i++) {
if (desc->pdata->child_names[i] == NULL)
continue;
conns[i].outport = desc->pdata->outports[i];
conns[i].child_name = desc->pdata->child_names[i];
conns[i].child_port = desc->pdata->child_ports[i];

View File

@ -58,6 +58,7 @@ static void of_coresight_get_ports(const struct device_node *node,
struct device_node *ep = NULL;
int in = 0, out = 0;
struct device_node *ports = NULL, *port = NULL;
struct of_endpoint endpoint;
ports = of_get_child_by_name(node, "ports");
port = of_get_child_by_name(node, "port");
@ -70,10 +71,15 @@ static void of_coresight_get_ports(const struct device_node *node,
if (!ep)
break;
if (of_graph_parse_endpoint(ep, &endpoint))
continue;
if (of_property_read_bool(ep, "slave-mode"))
in++;
in = (endpoint.port + 1 > in) ?
endpoint.port + 1 : in;
else
out++;
out = (endpoint.port + 1) > out ?
endpoint.port + 1 : out;
} while (ep);