From 8185b206af7d3a377d9b9c5e611f1f9ed36d6deb Mon Sep 17 00:00:00 2001 From: Shashank Mittal Date: Wed, 16 Mar 2016 15:06:14 -0700 Subject: [PATCH] coresight-tmc: add support to set default sink Add support to set default sink at probe time. Change-Id: I62abe39a5cb5e7f8b1bb1198cecd3b529b124de8 Signed-off-by: Shashank Mittal --- .../devicetree/bindings/arm/coresight.txt | 2 ++ drivers/hwtracing/coresight/coresight-tmc.c | 2 ++ drivers/hwtracing/coresight/coresight.c | 15 +++++++++++++++ include/linux/coresight.h | 4 +++- 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/arm/coresight.txt b/Documentation/devicetree/bindings/arm/coresight.txt index 4ea7d165090a..e90eeec3370e 100644 --- a/Documentation/devicetree/bindings/arm/coresight.txt +++ b/Documentation/devicetree/bindings/arm/coresight.txt @@ -68,6 +68,8 @@ its hardware characteristcs. * arm,buffer-size: size of contiguous buffer space for TMC ETR (embedded trace router) + * arm,default-sink: represents the default compile time CoreSight sink + * Required property for TPDAs: * qcom,tpda-atid: must be present. Specifies the ATID for TPDA. diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c index 735c2a54e530..27b6f1820223 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.c +++ b/drivers/hwtracing/coresight/coresight-tmc.c @@ -1673,6 +1673,8 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) return -ENOMEM; } + pdata->default_sink = of_property_read_bool(np, "arm,default-sink"); + desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL); if (!desc) return -ENOMEM; diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 2a5d1fb48dba..dc52b8a3c734 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -795,6 +795,21 @@ struct coresight_device *coresight_register(struct coresight_desc *desc) coresight_fixup_device_conns(csdev); coresight_fixup_orphan_conns(csdev); + if (csdev->type == CORESIGHT_DEV_TYPE_SINK || + csdev->type == CORESIGHT_DEV_TYPE_LINKSINK) { + if (desc->pdata->default_sink) { + if (curr_sink) { + dev_warn(&csdev->dev, + "overwritting curr sink %s", + dev_name(&curr_sink->dev)); + curr_sink->activated = false; + } + + curr_sink = csdev; + curr_sink->activated = true; + } + } + mutex_unlock(&coresight_mutex); return csdev; diff --git a/include/linux/coresight.h b/include/linux/coresight.h index 3a3ba938ff01..82e185645cf3 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012, 2016 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -101,6 +101,7 @@ struct coresight_dev_subtype { connected to. * @nr_outport: number of output ports for this component. * @clk: The clock this component is associated to. + * @default_sink: Flag to set default sink */ struct coresight_platform_data { int cpu; @@ -111,6 +112,7 @@ struct coresight_platform_data { int *child_ports; int nr_outport; struct clk *clk; + bool default_sink; }; /**