coresight: Dynamically add connections

Add a function for adding connections dynamically. This also removes
the 1:1 mapping between port number and the index into the connections
array. The only place this mapping was used was in the warning for
duplicate output ports, which has been replaced by a search. Other
uses of the port number already use the port member variable.

Being able to dynamically add connections will allow other devices like
CTI to re-use the connection mechanism despite not having explicit
connections described in the DT.

The connections array is now no longer sparse, so child_fwnode doesn't
need to be checked as all connections have a target node. Because the
array is no longer sparse, the high in and out port numbers are required
for the refcount arrays. But these will also be removed in a later
commit when the refcount is made a property of the connection.

Reviewed-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: James Clark <james.clark@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230425143542.2305069-7-james.clark@arm.com
This commit is contained in:
James Clark
2023-04-25 15:35:33 +01:00
committed by Suzuki K Poulose
parent d49c9cf15f
commit 3d4ff657e4
3 changed files with 77 additions and 78 deletions

View File

@@ -104,9 +104,11 @@ union coresight_dev_subtype {
*
* @nr_inconns: Number of elements for the input connections.
* @nr_outconns: Number of elements for the output connections.
* @out_conns: Sparse array of nr_outconns connections from this component.
* @out_conns: Array of nr_outconns connections from this component.
*/
struct coresight_platform_data {
int high_inport;
int high_outport;
int nr_inconns;
int nr_outconns;
struct coresight_connection *out_conns;
@@ -609,5 +611,9 @@ static inline void coresight_write64(struct coresight_device *csdev, u64 val, u3
extern int coresight_get_cpu(struct device *dev);
struct coresight_platform_data *coresight_get_platform_data(struct device *dev);
struct coresight_connection *
coresight_add_out_conn(struct device *dev,
struct coresight_platform_data *pdata,
const struct coresight_connection *new_conn);
#endif /* _LINUX_COREISGHT_H */