Skip to content

Commit 6d1fcd0

Browse files
coresight: configuring ETF in FIFO mode when acting as link
When part of a path but not identified as a sink, the EFT has to be configured as a link and placed in HW FIFO mode. As such when enabling a path, call the right configuration function based on the role the ETF if playing in this trace run. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit dc2c4ef141c5c14cb8d968ba16c74b4f3c373e2c)
1 parent 2686c05 commit 6d1fcd0

1 file changed

Lines changed: 28 additions & 4 deletions

File tree

drivers/hwtracing/coresight/coresight.c

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,15 +265,27 @@ static void coresight_disable_source(struct coresight_device *csdev)
265265

266266
void coresight_disable_path(struct list_head *path)
267267
{
268+
u32 type;
268269
struct coresight_node *nd;
269270
struct coresight_device *csdev, *parent, *child;
270271

271272
list_for_each_entry(nd, path, link) {
272273
csdev = nd->csdev;
274+
type = csdev->type;
273275

274-
switch (csdev->type) {
276+
/*
277+
* ETF devices are tricky... They can be a link or a sink,
278+
* depending on how they are configured. If an ETF has been
279+
* "activated" it will be configured as a sink, otherwise
280+
* go ahead with the link configuration.
281+
*/
282+
if (type == CORESIGHT_DEV_TYPE_LINKSINK)
283+
type = (csdev == coresight_get_sink(path)) ?
284+
CORESIGHT_DEV_TYPE_SINK :
285+
CORESIGHT_DEV_TYPE_LINK;
286+
287+
switch (type) {
275288
case CORESIGHT_DEV_TYPE_SINK:
276-
case CORESIGHT_DEV_TYPE_LINKSINK:
277289
coresight_disable_sink(csdev);
278290
break;
279291
case CORESIGHT_DEV_TYPE_SOURCE:
@@ -294,15 +306,27 @@ int coresight_enable_path(struct list_head *path, u32 mode)
294306
{
295307

296308
int ret = 0;
309+
u32 type;
297310
struct coresight_node *nd;
298311
struct coresight_device *csdev, *parent, *child;
299312

300313
list_for_each_entry_reverse(nd, path, link) {
301314
csdev = nd->csdev;
315+
type = csdev->type;
316+
317+
/*
318+
* ETF devices are tricky... They can be a link or a sink,
319+
* depending on how they are configured. If an ETF has been
320+
* "activated" it will be configured as a sink, otherwise
321+
* go ahead with the link configuration.
322+
*/
323+
if (type == CORESIGHT_DEV_TYPE_LINKSINK)
324+
type = (csdev == coresight_get_sink(path)) ?
325+
CORESIGHT_DEV_TYPE_SINK :
326+
CORESIGHT_DEV_TYPE_LINK;
302327

303-
switch (csdev->type) {
328+
switch (type) {
304329
case CORESIGHT_DEV_TYPE_SINK:
305-
case CORESIGHT_DEV_TYPE_LINKSINK:
306330
ret = coresight_enable_sink(csdev, mode);
307331
if (ret)
308332
goto err;

0 commit comments

Comments
 (0)