aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hwtracing/intel_th/gth.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/drivers/hwtracing/intel_th/gth.c b/drivers/hwtracing/intel_th/gth.c
index 33e09369a491..dd32d0bad687 100644
--- a/drivers/hwtracing/intel_th/gth.c
+++ b/drivers/hwtracing/intel_th/gth.c
@@ -564,6 +564,9 @@ static int intel_th_gth_assign(struct intel_th_device *thdev,
564 struct gth_device *gth = dev_get_drvdata(&thdev->dev); 564 struct gth_device *gth = dev_get_drvdata(&thdev->dev);
565 int i, id; 565 int i, id;
566 566
567 if (thdev->host_mode)
568 return -EBUSY;
569
567 if (othdev->type != INTEL_TH_OUTPUT) 570 if (othdev->type != INTEL_TH_OUTPUT)
568 return -EINVAL; 571 return -EINVAL;
569 572
@@ -600,6 +603,9 @@ static void intel_th_gth_unassign(struct intel_th_device *thdev,
600 struct gth_device *gth = dev_get_drvdata(&thdev->dev); 603 struct gth_device *gth = dev_get_drvdata(&thdev->dev);
601 int port = othdev->output.port; 604 int port = othdev->output.port;
602 605
606 if (thdev->host_mode)
607 return;
608
603 spin_lock(&gth->gth_lock); 609 spin_lock(&gth->gth_lock);
604 othdev->output.port = -1; 610 othdev->output.port = -1;
605 othdev->output.active = false; 611 othdev->output.active = false;
@@ -654,9 +660,24 @@ static int intel_th_gth_probe(struct intel_th_device *thdev)
654 gth->base = base; 660 gth->base = base;
655 spin_lock_init(&gth->gth_lock); 661 spin_lock_init(&gth->gth_lock);
656 662
663 /*
664 * Host mode can be signalled via SW means or via SCRPD_DEBUGGER_IN_USE
665 * bit. Either way, don't reset HW in this case, and don't export any
666 * capture configuration attributes. Also, refuse to assign output
667 * drivers to ports, see intel_th_gth_assign().
668 */
669 if (thdev->host_mode)
670 goto done;
671
657 ret = intel_th_gth_reset(gth); 672 ret = intel_th_gth_reset(gth);
658 if (ret) 673 if (ret) {
659 return ret; 674 if (ret != -EBUSY)
675 return ret;
676
677 thdev->host_mode = true;
678
679 goto done;
680 }
660 681
661 for (i = 0; i < TH_CONFIGURABLE_MASTERS + 1; i++) 682 for (i = 0; i < TH_CONFIGURABLE_MASTERS + 1; i++)
662 gth->master[i] = -1; 683 gth->master[i] = -1;
@@ -677,6 +698,7 @@ static int intel_th_gth_probe(struct intel_th_device *thdev)
677 return -ENOMEM; 698 return -ENOMEM;
678 } 699 }
679 700
701done:
680 dev_set_drvdata(dev, gth); 702 dev_set_drvdata(dev, gth);
681 703
682 return 0; 704 return 0;