From patchwork Fri Mar 17 03:04:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 71056 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp119311wrt; Thu, 16 Mar 2023 20:16:01 -0700 (PDT) X-Google-Smtp-Source: AK7set9E6dwFdWY3TtOG+tbD2njxfblyX644RIfXQqbrQd1xtyj/GARXc7BakrWZFJOqCvkSgeTR X-Received: by 2002:a6b:651a:0:b0:71b:5cd7:fcd9 with SMTP id z26-20020a6b651a000000b0071b5cd7fcd9mr704183iob.20.1679022961715; Thu, 16 Mar 2023 20:16:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679022961; cv=none; d=google.com; s=arc-20160816; b=waVPGDm2hZFiSs4wrZq/D6Lzt9hXvtSbBXhPeV1k5PBsYrfJfONdVynr552JKbwwJg Mny219TkFRZ1Ml1JLfZ1+R4EFVRCiqfelrahrpx6QhX0DO+5UapO0SnI3sfTyi392EXG khhPEcz1aLIbyNV5KcGODDPDEsp6aGT2YOHm18PutP59b0q6EqMAfXLey3D82K8WuH/g dHNnwRMFPgGvpaFb4tpirGfZLuS4RSWgLrJ19k1PF2dYqVVyKTn4jK2IXMA7UFqqBNKt 6dw4pSVnK5dpH2mJ5y8bw3ac62S+x2ZfpjhlF/jza1jqQtzy8pprq5jR0Pz4y0gBa8s9 FUEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=YNl48d59wlnYE63Gu5q16OOd0QVJNAHILkVXxCt2bhc=; b=d9aZXm/V08i0dABcsMVIq0WMNn5jKRyEqjpDO22KgjeAJurtCpY1ebzIrpwSfIIDA+ Bd4tT7BbHHyRFWgwRasKhfOCEtdYro7JNZDOiO3Q98y/+cZaLJsaQUQp1X+jEpv1983i JPFgRgERaporrEQxQVYvXjijlSWac8yrc+BLFdrYxpOZgGM7mJoKSQONyKiAffLWtXDp fXoxgwyVmJ8lM9B3M3w4F5xkTZC9lFm5JqQkZcI2ZkQtCugS/wAfeTUJltWd2BAZdgYk /qpO7aGITMe5lx+OlcHVgBtAyGPKp+Tio1yxLK2EHl3HYYSd/PnKG2YNq7EblYBo1VYk 4mEA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p6-20020a5ecb06000000b0074c8d0f0981si1004219iom.95.2023.03.16.20.15.42; Thu, 16 Mar 2023 20:16:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229542AbjCQDFb (ORCPT + 99 others); Thu, 16 Mar 2023 23:05:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229772AbjCQDF3 (ORCPT ); Thu, 16 Mar 2023 23:05:29 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id ECA31EC45; Thu, 16 Mar 2023 20:05:27 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 63AFE1480; Thu, 16 Mar 2023 20:06:11 -0700 (PDT) Received: from a077893.blr.arm.com (unknown [10.162.40.17]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id CD4693F64C; Thu, 16 Mar 2023 20:05:21 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, suzuki.poulose@arm.com Cc: scclevenger@os.amperecomputing.com, Anshuman Khandual , Rob Herring , Frank Rowand , Russell King , Greg Kroah-Hartman , "Rafael J. Wysocki" , Len Brown , Sudeep Holla , Lorenzo Pieralisi , Mathieu Poirier , Mike Leach , Leo Yan , devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/7] coresight: etm4x: Allocate and device assign 'struct etmv4_drvdata' earlier Date: Fri, 17 Mar 2023 08:34:55 +0530 Message-Id: <20230317030501.1811905-2-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230317030501.1811905-1-anshuman.khandual@arm.com> References: <20230317030501.1811905-1-anshuman.khandual@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760583181153563074?= X-GMAIL-MSGID: =?utf-8?q?1760583181153563074?= Allocate and device assign 'struct etmv4_drvdata' earlier during the driver probe, ensuring that it can be retrieved in power management based runtime callbacks if required. This will also help in dropping iomem base address argument from the function etm4_probe() later. Cc: Mathieu Poirier Cc: Suzuki K Poulose Cc: Mike Leach Cc: Leo Yan Cc: coresight@lists.linaro.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- .../coresight/coresight-etm4x-core.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index 1ea8f173cca0..10119c223fbe 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -2050,17 +2050,14 @@ static int etm4_add_coresight_dev(struct etm4_init_arg *init_arg) static int etm4_probe(struct device *dev, void __iomem *base, u32 etm_pid) { - struct etmv4_drvdata *drvdata; + struct etmv4_drvdata *drvdata = dev_get_drvdata(dev); struct csdev_access access = { 0 }; struct etm4_init_arg init_arg = { 0 }; struct etm4_init_arg *delayed; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); - if (!drvdata) + if (WARN_ON(!drvdata)) return -ENOMEM; - dev_set_drvdata(dev, drvdata); - if (pm_save_enable == PARAM_PM_SAVE_FIRMWARE) pm_save_enable = coresight_loses_context_with_cpu(dev) ? PARAM_PM_SAVE_SELF_HOSTED : PARAM_PM_SAVE_NEVER; @@ -2112,6 +2109,7 @@ static int etm4_probe(struct device *dev, void __iomem *base, u32 etm_pid) static int etm4_probe_amba(struct amba_device *adev, const struct amba_id *id) { + struct etmv4_drvdata *drvdata; void __iomem *base; struct device *dev = &adev->dev; struct resource *res = &adev->res; @@ -2122,6 +2120,11 @@ static int etm4_probe_amba(struct amba_device *adev, const struct amba_id *id) if (IS_ERR(base)) return PTR_ERR(base); + drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + if (!drvdata) + return -ENOMEM; + + dev_set_drvdata(dev, drvdata); ret = etm4_probe(dev, base, id->id); if (!ret) pm_runtime_put(&adev->dev); @@ -2131,8 +2134,14 @@ static int etm4_probe_amba(struct amba_device *adev, const struct amba_id *id) static int etm4_probe_platform_dev(struct platform_device *pdev) { + struct etmv4_drvdata *drvdata; int ret; + drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); + if (!drvdata) + return -ENOMEM; + + dev_set_drvdata(&pdev->dev, drvdata); pm_runtime_get_noresume(&pdev->dev); pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); From patchwork Fri Mar 17 03:04:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 71048 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp116592wrt; Thu, 16 Mar 2023 20:07:34 -0700 (PDT) X-Google-Smtp-Source: AK7set8qeFTrCWw3I2EUs3m9cKbGnNd2dIi+Zby9+zO0+Nysk6ffbvvKEuf53ZqSKLuQ/xkpafnD X-Received: by 2002:a17:90b:388d:b0:234:b082:48a2 with SMTP id mu13-20020a17090b388d00b00234b08248a2mr6372598pjb.28.1679022454233; Thu, 16 Mar 2023 20:07:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679022454; cv=none; d=google.com; s=arc-20160816; b=nwqh/yYiR2tHmtJ16neroDv1PCfND4bN+AE2OqbBe8f8PnN0vab0IoCbJ8eWvtz1Mg VDLsgNHGIWzmkkZL714dZsLbkENLmqhGyXTwxVTeDHk8RqxOQdvrkEbCi4iUGLZ/I9fe 9S4bEvzkJlc8r/WUsxVmjZsW9MNiOoKgh58eyfoAXoXuIjUbRroJKkxNekVSrO9WWJmr rEZwCFk3pAnXts0eA1S2XkPWEdtkCtoA6kZr+TB8rvXCA5rQVPziFoyZjkbprquapI1s oB9GNDpKQnBq57q2WKO+hwnmoCQbjStvCxyUhOVtBQJmgQK6eeagq5ox3u8hSyeBp9eB YK9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=6Gi4/49EQaY5F173VRmAAdjV2avRwD4xBU+tmojtZgA=; b=MkpLvAP7FHEpALhN/S1QZbM03z0nHMsfARitvVSzMa0MKnT3RO50ihfTwtVdyOwyDR wk21qWHu70M9UX5b2PLDUrDi/QamiKOy9m9Zhz9KO4GnzK5WMDYu/mueZfQNty5qmQ1g CkzFedvknMImiacrX4M38HAtHJWwmDw5tAI8wiX36XPuWayASEZziryE05oOS9HCSMkS bgYFpwwVNdzU9y4jV5iotnnFOfBrMg2yrdNk3cv/bXCk7Udv6zX5QwP1cGSZ5f/RzP8/ UZcmAWyizve46aFr4zP4bWozGainrmyfI8XSgUChB6MqOa1k8DRpPiuZhaqVT/gVKNJp eO1Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pm9-20020a17090b3c4900b002344ef1a33esi862682pjb.98.2023.03.16.20.07.18; Thu, 16 Mar 2023 20:07:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229770AbjCQDFw (ORCPT + 99 others); Thu, 16 Mar 2023 23:05:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229808AbjCQDFn (ORCPT ); Thu, 16 Mar 2023 23:05:43 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C3B846E68D; Thu, 16 Mar 2023 20:05:34 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4BD804B3; Thu, 16 Mar 2023 20:06:18 -0700 (PDT) Received: from a077893.blr.arm.com (unknown [10.162.40.17]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2E47C3F64C; Thu, 16 Mar 2023 20:05:27 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, suzuki.poulose@arm.com Cc: scclevenger@os.amperecomputing.com, Anshuman Khandual , Rob Herring , Frank Rowand , Russell King , Greg Kroah-Hartman , "Rafael J. Wysocki" , Len Brown , Sudeep Holla , Lorenzo Pieralisi , Mathieu Poirier , Mike Leach , Leo Yan , devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/7] coresight: etm4x: Drop iomem 'base' argument from etm4_probe() Date: Fri, 17 Mar 2023 08:34:56 +0530 Message-Id: <20230317030501.1811905-3-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230317030501.1811905-1-anshuman.khandual@arm.com> References: <20230317030501.1811905-1-anshuman.khandual@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760582648505983638?= X-GMAIL-MSGID: =?utf-8?q?1760582648505983638?= 'struct etm4_drvdata' itself can carry the base address before etm4_probe() gets called. Just drop that redundant argument from etm4_probe(). Cc: Mathieu Poirier Cc: Suzuki K Poulose Cc: Mike Leach Cc: Leo Yan Cc: coresight@lists.linaro.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- drivers/hwtracing/coresight/coresight-etm4x-core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index 10119c223fbe..5d77571a8df9 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -2048,7 +2048,7 @@ static int etm4_add_coresight_dev(struct etm4_init_arg *init_arg) return 0; } -static int etm4_probe(struct device *dev, void __iomem *base, u32 etm_pid) +static int etm4_probe(struct device *dev, u32 etm_pid) { struct etmv4_drvdata *drvdata = dev_get_drvdata(dev); struct csdev_access access = { 0 }; @@ -2069,8 +2069,6 @@ static int etm4_probe(struct device *dev, void __iomem *base, u32 etm_pid) return -ENOMEM; } - drvdata->base = base; - spin_lock_init(&drvdata->spinlock); drvdata->cpu = coresight_get_cpu(dev); @@ -2124,8 +2122,9 @@ static int etm4_probe_amba(struct amba_device *adev, const struct amba_id *id) if (!drvdata) return -ENOMEM; + drvdata->base = base; dev_set_drvdata(dev, drvdata); - ret = etm4_probe(dev, base, id->id); + ret = etm4_probe(dev, id->id); if (!ret) pm_runtime_put(&adev->dev); @@ -2141,6 +2140,7 @@ static int etm4_probe_platform_dev(struct platform_device *pdev) if (!drvdata) return -ENOMEM; + drvdata->base = NULL; dev_set_drvdata(&pdev->dev, drvdata); pm_runtime_get_noresume(&pdev->dev); pm_runtime_set_active(&pdev->dev); @@ -2151,7 +2151,7 @@ static int etm4_probe_platform_dev(struct platform_device *pdev) * HW by reading appropriate registers on the HW * and thus we could skip the PID. */ - ret = etm4_probe(&pdev->dev, NULL, 0); + ret = etm4_probe(&pdev->dev, 0); pm_runtime_put(&pdev->dev); return ret; From patchwork Fri Mar 17 03:04:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 71053 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp119157wrt; Thu, 16 Mar 2023 20:15:31 -0700 (PDT) X-Google-Smtp-Source: AK7set/MOV2EXnKvyjVNAmXpQZAgcXKhtbgvz9WOsHDeRf6/iNtc2ObKW3YZBSGlMzvK/huVSvb+ X-Received: by 2002:a05:6a20:3d05:b0:d6:775f:5105 with SMTP id y5-20020a056a203d0500b000d6775f5105mr7192210pzi.4.1679022931273; Thu, 16 Mar 2023 20:15:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679022931; cv=none; d=google.com; s=arc-20160816; b=ldEkRJxyzTxNSVEXoQKfRM24XHx7a3jaDBTtsfej8kjc7RQ2yivxSKRKBTr/vHYSx1 QXdXEDEytMcj6eHX8a19FCDhCoZGrHjaSTnqcozwlAd0mzX0T7omY6ZrpK8qJ70OWCp/ lWLoyMimtICUh3ynhpDew/6yyvoGA4gajRdqEwmnwD+9g64ZGZMjRjrsry6SyIQG3wJn ADD3zt0BMPwDTM0jE0hD11tCOMQ7CoY9YGAEnkeZkMRrSD3PGMgeI8choKG+ZTpmrtW7 3txnEz6Aw6IJVBQW2dG9iD9K3Rq8g0wAvHaWuCfgLTs54T+TfSkp6O8/dRrex8bnNhV8 ttOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=8BKBy4o/GGMS3xRu7yK601vkyurkNf5zTKwzzOAuq34=; b=Z/tTpOlwuXLOzDGd1OohddeEkdwGlOcJ1C8IMLkj8OiM8Ng/P13Qw6+iFSNs51bJm0 vO3lAU54jlB/GWb1PyCgpEAyguZSBWf0jKy/J4isNXuhe8C/uVghVbmdZoxEOa2hytfK oHYOI5fO1Dn6YGF4D8s8mGhvCgER6CgvF2ADDMugI8dNmDVrjiuDeanfQOhdSI+vSzwe BwzMDAhrFLEeQ/41+XD2aIU3FzJF/+tkt7Wm4jTfl1++TMiZ+HrdiZs0JULQ4p9z4Eaq sYHtzCr1lqg3pkNSb+gFnTOTsZPDxvFOPS6VBqrI03g6J1IJPjFWRH3+g2rdVcG2Pk0N JAUA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b1-20020a656681000000b004fb6f10cd3asi1034676pgw.871.2023.03.16.20.15.17; Thu, 16 Mar 2023 20:15:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229948AbjCQDGM (ORCPT + 99 others); Thu, 16 Mar 2023 23:06:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229890AbjCQDFw (ORCPT ); Thu, 16 Mar 2023 23:05:52 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BAFF3B483D; Thu, 16 Mar 2023 20:05:41 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D2D5E4B3; Thu, 16 Mar 2023 20:06:24 -0700 (PDT) Received: from a077893.blr.arm.com (unknown [10.162.40.17]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 252A53F64C; Thu, 16 Mar 2023 20:05:34 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, suzuki.poulose@arm.com Cc: scclevenger@os.amperecomputing.com, Anshuman Khandual , Rob Herring , Frank Rowand , Russell King , Greg Kroah-Hartman , "Rafael J. Wysocki" , Len Brown , Sudeep Holla , Lorenzo Pieralisi , Mathieu Poirier , Mike Leach , Leo Yan , devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/7] coresight: etm4x: Drop pid argument from etm4_probe() Date: Fri, 17 Mar 2023 08:34:57 +0530 Message-Id: <20230317030501.1811905-4-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230317030501.1811905-1-anshuman.khandual@arm.com> References: <20230317030501.1811905-1-anshuman.khandual@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760583149024772110?= X-GMAIL-MSGID: =?utf-8?q?1760583149024772110?= Coresight device pid can be retrieved from its iomem base address, which is stored in 'struct etm4x_drvdata'. This drops pid argument from etm4_probe() and 'struct etm4_init_arg'. Instead etm4_check_arch_features() derives the coresight device pid with a new helper coresight_get_pid(), right before it is consumed in etm4_hisi_match_pid(). Cc: Mathieu Poirier Cc: Suzuki K Poulose Cc: Mike Leach Cc: Leo Yan Cc: coresight@lists.linaro.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- .../coresight/coresight-etm4x-core.c | 19 +++++++------------ include/linux/coresight.h | 12 ++++++++++++ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index 5d77571a8df9..a4c138e67920 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -66,7 +66,6 @@ static u64 etm4_get_access_type(struct etmv4_config *config); static enum cpuhp_state hp_online; struct etm4_init_arg { - unsigned int pid; struct device *dev; struct csdev_access *csa; }; @@ -370,8 +369,10 @@ static void etm4_disable_arch_specific(struct etmv4_drvdata *drvdata) } static void etm4_check_arch_features(struct etmv4_drvdata *drvdata, - unsigned int id) + struct csdev_access *csa) { + unsigned int id = coresight_get_pid(csa); + if (etm4_hisi_match_pid(id)) set_bit(ETM4_IMPDEF_HISI_CORE_COMMIT, drvdata->arch_features); } @@ -1165,7 +1166,7 @@ static void etm4_init_arch_data(void *info) etm4_os_unlock_csa(drvdata, csa); etm4_cs_unlock(drvdata, csa); - etm4_check_arch_features(drvdata, init_arg->pid); + etm4_check_arch_features(drvdata, csa); /* find all capabilities of the tracing unit */ etmidr0 = etm4x_relaxed_read32(csa, TRCIDR0); @@ -2048,7 +2049,7 @@ static int etm4_add_coresight_dev(struct etm4_init_arg *init_arg) return 0; } -static int etm4_probe(struct device *dev, u32 etm_pid) +static int etm4_probe(struct device *dev) { struct etmv4_drvdata *drvdata = dev_get_drvdata(dev); struct csdev_access access = { 0 }; @@ -2077,7 +2078,6 @@ static int etm4_probe(struct device *dev, u32 etm_pid) init_arg.dev = dev; init_arg.csa = &access; - init_arg.pid = etm_pid; /* * Serialize against CPUHP callbacks to avoid race condition @@ -2124,7 +2124,7 @@ static int etm4_probe_amba(struct amba_device *adev, const struct amba_id *id) drvdata->base = base; dev_set_drvdata(dev, drvdata); - ret = etm4_probe(dev, id->id); + ret = etm4_probe(dev); if (!ret) pm_runtime_put(&adev->dev); @@ -2146,12 +2146,7 @@ static int etm4_probe_platform_dev(struct platform_device *pdev) pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); - /* - * System register based devices could match the - * HW by reading appropriate registers on the HW - * and thus we could skip the PID. - */ - ret = etm4_probe(&pdev->dev, 0); + ret = etm4_probe(&pdev->dev); pm_runtime_put(&pdev->dev); return ret; diff --git a/include/linux/coresight.h b/include/linux/coresight.h index f19a47b9bb5a..f85b041ea475 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -370,6 +370,18 @@ static inline u32 csdev_access_relaxed_read32(struct csdev_access *csa, return csa->read(offset, true, false); } +#define CORESIGHT_PIDRn(i) (0xFE0 + ((i) * 4)) + +static inline u32 coresight_get_pid(struct csdev_access *csa) +{ + u32 i, pid = 0; + + for (i = 0; i < 4; i++) + pid |= csdev_access_relaxed_read32(csa, CORESIGHT_PIDRn(i)) << (i * 8); + + return pid; +} + static inline u64 csdev_access_relaxed_read_pair(struct csdev_access *csa, u32 lo_offset, u32 hi_offset) { From patchwork Fri Mar 17 03:04:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 71052 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp118021wrt; Thu, 16 Mar 2023 20:12:05 -0700 (PDT) X-Google-Smtp-Source: AK7set8Dijqehf8BInGWRou+RxRcea5VHj6Ol+UeAeBv8klQe06jCQM3DNgg0opm7ryWc7F53ZCm X-Received: by 2002:a05:6a20:65a6:b0:d4:9df2:e7bc with SMTP id p38-20020a056a2065a600b000d49df2e7bcmr5063177pzh.29.1679022725290; Thu, 16 Mar 2023 20:12:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679022725; cv=none; d=google.com; s=arc-20160816; b=r1xnYnmZ4QtMbMrz31wIS0UuMQi3qeCAJlkbokYmvT4ClQeIqZscX5N4N4HfJnRN1f 3bkzuppzQM9K/QTO1Kl4bffCTvS6Y4jU2JM3fyhkmJXVSEN8DFe6D6f9Tizv2LAbHhWh h5aBtHuHdVYAwx7Ln+BsV5WamHe4Yo+q4gfl2w4wZPgS3ppXQ0mrOVnNkcW10YEwM/aH 26v9+7r5wrvMaghEefUJyTpY0EK6UlpnAdkD4r5IAaIUIIUDx4/e5KxBpod9DPvbgznL rfEV8jNpMdVj49eSaw7TmypPZbu58c050PYbzWnq23n9H05LvyWJp/x2EPDZXlVfiL8Y KKhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=0CQyn7lpRkjIFCY/lOsQm+iMrQzvgkRkE9mDZRPvMZM=; b=jGSPjdEXr2lO6NhG7DCKYo+C+RVYxZMLjXNcuFFirW9FB08FuSSxWKx+B23+JLZ48x yitmwR57al8QnjSE4HH6BIKjMGtZTNus6N7NyAXpsYtTaAriUM+Y6HNfCOfLmdbAe/ms hSQOpdc9pyX2XCqCkpgGrENWO23xiQ3wrqOCACFqvNoCbaPUcqdacZQeQeHlxZxPmaY9 LFOP1qSfc01/QgzdTx3Kuhwyw/Tz9lhPZ7/gNFSopIg/OrrcPiafrTjBGOBbIb6oOGU/ 51ZrTVdxPX1HDUDT16S+KpL+DCfrxmc1OL7nmVMYRfWR1dOZsQqQtPMBqc2sMZ6fiSVV Wl3A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r11-20020a632b0b000000b0050c09582a0dsi1089908pgr.40.2023.03.16.20.11.52; Thu, 16 Mar 2023 20:12:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230007AbjCQDGa (ORCPT + 99 others); Thu, 16 Mar 2023 23:06:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229913AbjCQDGF (ORCPT ); Thu, 16 Mar 2023 23:06:05 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 79296B3739; Thu, 16 Mar 2023 20:05:47 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E4F461480; Thu, 16 Mar 2023 20:06:30 -0700 (PDT) Received: from a077893.blr.arm.com (unknown [10.162.40.17]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 9C3383F64C; Thu, 16 Mar 2023 20:05:41 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, suzuki.poulose@arm.com Cc: scclevenger@os.amperecomputing.com, Anshuman Khandual , Rob Herring , Frank Rowand , Russell King , Greg Kroah-Hartman , "Rafael J. Wysocki" , Len Brown , Sudeep Holla , Lorenzo Pieralisi , Mathieu Poirier , Mike Leach , Leo Yan , devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/7] coresight: etm4x: Change etm4_platform_driver driver for MMIO devices Date: Fri, 17 Mar 2023 08:34:58 +0530 Message-Id: <20230317030501.1811905-5-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230317030501.1811905-1-anshuman.khandual@arm.com> References: <20230317030501.1811905-1-anshuman.khandual@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760582933481579802?= X-GMAIL-MSGID: =?utf-8?q?1760582933481579802?= This updates existing etm4_platform_driver to accommodate MMIO based device tree represented coresight etm4x devices along with current sysreg ones. It first looks for 'apb_clk' clock and tries to enable it via a new helper i.e coresight_get_enable_apb_pclk(). If 'apb_clock' is not found on the system as indicated by a return value 'NULL', ignore and proceed further assuming that platform already has got required clocks enabled. But if the clock is but could not be enabled, device probe fails with -ENODEV. Similarly iomem base address is fetched via devm_ioremap_resource() onyl when the platform has valid 'struct resource'. The probed device is ensured to be a coresight etm4x, via two new helpers in etm4_init_iomem_access(). This also registers runtime power management callbacks i.e for suspend and resume operations. Cc: Mathieu Poirier Cc: Suzuki K Poulose Cc: Mike Leach Cc: Leo Yan Cc: coresight@lists.linaro.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- .../coresight/coresight-etm4x-core.c | 62 +++++++++++++++++-- drivers/hwtracing/coresight/coresight-etm4x.h | 3 + include/linux/coresight.h | 44 +++++++++++++ 3 files changed, 105 insertions(+), 4 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index a4c138e67920..60f027e33aa0 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -1067,12 +1068,24 @@ static bool etm4_init_sysreg_access(struct etmv4_drvdata *drvdata, return true; } +static bool is_etm4x_device(void __iomem *base) +{ + u32 devarch = readl(base + TRCDEVARCH); + u32 devtype = readl(base + TRCDEVTYPE); + + return (((devarch & ETM_DEVARCH_ID_MASK) == ETM_DEVARCH_ETMv4x_ARCH) && + (devtype == ETM_DEVTYPE_ETMv4x_ARCH)); +} + static bool etm4_init_iomem_access(struct etmv4_drvdata *drvdata, struct csdev_access *csa) { u32 devarch = readl_relaxed(drvdata->base + TRCDEVARCH); u32 idr1 = readl_relaxed(drvdata->base + TRCIDR1); + if (!is_coresight_device(drvdata->base) || !is_etm4x_device(drvdata->base)) + return false; + /* * All ETMs must implement TRCDEVARCH to indicate that * the component is an ETMv4. To support any broken @@ -2133,6 +2146,7 @@ static int etm4_probe_amba(struct amba_device *adev, const struct amba_id *id) static int etm4_probe_platform_dev(struct platform_device *pdev) { + struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); struct etmv4_drvdata *drvdata; int ret; @@ -2140,7 +2154,16 @@ static int etm4_probe_platform_dev(struct platform_device *pdev) if (!drvdata) return -ENOMEM; - drvdata->base = NULL; + drvdata->pclk = coresight_get_enable_apb_pclk(&pdev->dev); + if (IS_ERR(drvdata->pclk)) + return -ENODEV; + + if (res) { + drvdata->base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(drvdata->base)) + return PTR_ERR(drvdata->base); + } + dev_set_drvdata(&pdev->dev, drvdata); pm_runtime_get_noresume(&pdev->dev); pm_runtime_set_active(&pdev->dev); @@ -2186,7 +2209,7 @@ static struct amba_cs_uci_id uci_id_etm4[] = { /* ETMv4 UCI data */ .devarch = ETM_DEVARCH_ETMv4x_ARCH, .devarch_mask = ETM_DEVARCH_ID_MASK, - .devtype = 0x00000013, + .devtype = ETM_DEVTYPE_ETMv4x_ARCH, } }; @@ -2244,6 +2267,10 @@ static int __exit etm4_remove_platform_dev(struct platform_device *pdev) if (drvdata) ret = etm4_remove_dev(drvdata); + + if (!IS_ERR(drvdata->pclk)) + clk_put(drvdata->pclk); + pm_runtime_disable(&pdev->dev); return ret; } @@ -2284,7 +2311,34 @@ static struct amba_driver etm4x_amba_driver = { .id_table = etm4_ids, }; -static const struct of_device_id etm4_sysreg_match[] = { +#ifdef CONFIG_PM +static int etm4_runtime_suspend(struct device *dev) +{ + struct etmv4_drvdata *drvdata = dev_get_drvdata(dev); + + if (!IS_ERR(drvdata->pclk)) + clk_disable_unprepare(drvdata->pclk); + + return 0; +} + +static int etm4_runtime_resume(struct device *dev) +{ + struct etmv4_drvdata *drvdata = dev_get_drvdata(dev); + + if (!IS_ERR(drvdata->pclk)) + clk_prepare_enable(drvdata->pclk); + + return 0; +} +#endif + +static const struct dev_pm_ops etm4_dev_pm_ops = { + SET_RUNTIME_PM_OPS(etm4_runtime_suspend, etm4_runtime_resume, NULL) +}; + +static const struct of_device_id etm4_match[] = { + { .compatible = "arm,coresight-etm4x" }, { .compatible = "arm,coresight-etm4x-sysreg" }, { .compatible = "arm,embedded-trace-extension" }, {} @@ -2295,7 +2349,7 @@ static struct platform_driver etm4_platform_driver = { .remove = etm4_remove_platform_dev, .driver = { .name = "coresight-etm4x", - .of_match_table = etm4_sysreg_match, + .of_match_table = etm4_match, .suppress_bind_attrs = true, }, }; diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h index 434f4e95ee17..5a37df4a02e9 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -701,6 +701,8 @@ #define ETM_DEVARCH_ETE_ARCH \ (ETM_DEVARCH_ARCHITECT_ARM | ETM_DEVARCH_ARCHID_ETE | ETM_DEVARCH_PRESENT) +#define ETM_DEVTYPE_ETMv4x_ARCH 0x00000013 + #define TRCSTATR_IDLE_BIT 0 #define TRCSTATR_PMSTABLE_BIT 1 #define ETM_DEFAULT_ADDR_COMP 0 @@ -1017,6 +1019,7 @@ struct etmv4_save_state { * @arch_features: Bitmap of arch features of etmv4 devices. */ struct etmv4_drvdata { + struct clk *pclk; void __iomem *base; struct coresight_device *csdev; spinlock_t spinlock; diff --git a/include/linux/coresight.h b/include/linux/coresight.h index f85b041ea475..75a7aa6d7444 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -6,6 +6,8 @@ #ifndef _LINUX_CORESIGHT_H #define _LINUX_CORESIGHT_H +#include +#include #include #include #include @@ -370,6 +372,48 @@ static inline u32 csdev_access_relaxed_read32(struct csdev_access *csa, return csa->read(offset, true, false); } +#define CORESIGHT_CIDRn(i) (0xFF0 + ((i) * 4)) + +static inline u32 coresight_get_cid(void __iomem *base) +{ + u32 i, cid = 0; + + for (i = 0; i < 4; i++) + cid |= readl(base + CORESIGHT_CIDRn(i)) << (i * 8); + + return cid; +} + +static inline bool is_coresight_device(void __iomem *base) +{ + u32 cid = coresight_get_cid(base); + + return cid == CORESIGHT_CID; +} + +/* + * This function attempts to find a 'apb_pclk' clock on the system and + * if found, enables it. This returns NULL if 'apb_pclk' clock is not + * and return error pointer from clk_prepare_enable(), if it fails to + * enable the discovered clock. + */ +static inline struct clk *coresight_get_enable_apb_pclk(struct device *dev) +{ + struct clk *pclk; + int ret; + + pclk = clk_get(dev, "apb_pclk"); + if (IS_ERR(pclk)) + return NULL; + + ret = clk_prepare_enable(pclk); + if (ret) { + clk_put(pclk); + return ERR_PTR(ret); + } + return pclk; +} + #define CORESIGHT_PIDRn(i) (0xFE0 + ((i) * 4)) static inline u32 coresight_get_pid(struct csdev_access *csa) From patchwork Fri Mar 17 03:04:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 71054 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp119166wrt; Thu, 16 Mar 2023 20:15:33 -0700 (PDT) X-Google-Smtp-Source: AK7set9AS484D+oM0m3b2JpmQKmm7xpKmqxAY3977TGkGhb4crsJXKXVF4Sm6Qq3Yyz1ghx0TOn/ X-Received: by 2002:a05:6a20:4918:b0:d4:53ff:2ef5 with SMTP id ft24-20020a056a20491800b000d453ff2ef5mr5745403pzb.26.1679022933323; Thu, 16 Mar 2023 20:15:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679022933; cv=none; d=google.com; s=arc-20160816; b=c6+0yWLwzyTgN7tMWlhLn5ufm0gMn24LlhmexJFK3ac74MnnzeHfGHqPtnRxnjDIIP oCKKy2PjJKjHFZMpAsmS6GRGZaZW7LXQcihhxT48fpRLCNkaKiUQcSXrQJ9LuAeCLxGp H9WAdyY9O2iujcLByp7vLnjuGX8f9q1+0kKUYoKnZCzHpLBELSyOlkqs7Y1V8a4k0zMd JjAuxipLUizjAYJbyxtfiqBzkoBwkrDWjMmcH3gW+flifXcOM9To71NCOL3n5siA4Fo8 ViqCHonv1L7KvTTzA5ZVUWp8+eYlD+WKg07Wz7bllaIt6CQJq25Bm4asR55oH8U55yy0 YWow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=VpQgEw3ns7oqA+xR9YPvQA5T1V3GtWD+yEcgG3qeq7U=; b=PwaBHblsYJ8PvHAwOgRt1u0LvZQP5pjaGlZ6rxdt4IK4lUv2A1p2acjMDBz7Pvf1Yo dE2vcNDpuMeaw1HXtru2TNp/42T9W3PVRcd7Rpn0Il9R7BuXqO3X4kk5Pe0t88hKn0xr Jxv3XzWeVlSkIaKp0jwsRSLxYFQN50Ej8chw6rqMKcQbX8YwpXUSr/XWCkvGEzqX2jL+ cSqWUuCzQBLgTy4oP4I9BNLY2M/6dbKqb+UVQOsbLllppa8zTnO6EdZ6Vutlin+Hx5il QCY1sdso3CCDI8Xc7AFdJ2QJJeAlRDLE9GwdgKzxKKwms/4rH3BQcnsc1ngqYt8MDDij 2gXQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s5-20020a63e805000000b00502effd3bb9si1054422pgh.521.2023.03.16.20.15.20; Thu, 16 Mar 2023 20:15:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230037AbjCQDGq (ORCPT + 99 others); Thu, 16 Mar 2023 23:06:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229923AbjCQDGK (ORCPT ); Thu, 16 Mar 2023 23:06:10 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8E0B6B5FF7; Thu, 16 Mar 2023 20:05:53 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 020B3175D; Thu, 16 Mar 2023 20:06:37 -0700 (PDT) Received: from a077893.blr.arm.com (unknown [10.162.40.17]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A38303F64C; Thu, 16 Mar 2023 20:05:47 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, suzuki.poulose@arm.com Cc: scclevenger@os.amperecomputing.com, Anshuman Khandual , Rob Herring , Frank Rowand , Russell King , Greg Kroah-Hartman , "Rafael J. Wysocki" , Len Brown , Sudeep Holla , Lorenzo Pieralisi , Mathieu Poirier , Mike Leach , Leo Yan , devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/7] coresight: etm4x: Add ACPI support in platform driver Date: Fri, 17 Mar 2023 08:34:59 +0530 Message-Id: <20230317030501.1811905-6-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230317030501.1811905-1-anshuman.khandual@arm.com> References: <20230317030501.1811905-1-anshuman.khandual@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760583151228279559?= X-GMAIL-MSGID: =?utf-8?q?1760583151228279559?= From: Suzuki Poulose Drop ETM4X ACPI ID from the AMBA ACPI device list, and instead just move it inside the new ACPI devices list detected and used via platform driver. Cc: "Rafael J. Wysocki" Cc: Len Brown Cc: Mathieu Poirier Cc: Suzuki K Poulose Cc: Mike Leach Cc: Leo Yan Cc: Sudeep Holla Cc: Lorenzo Pieralisi Cc: linux-acpi@vger.kernel.org Cc: coresight@lists.linaro.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Suzuki Poulose Signed-off-by: Anshuman Khandual --- drivers/acpi/acpi_amba.c | 1 - drivers/hwtracing/coresight/coresight-etm4x-core.c | 10 ++++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/acpi_amba.c b/drivers/acpi/acpi_amba.c index f5b443ab01c2..099966cbac5a 100644 --- a/drivers/acpi/acpi_amba.c +++ b/drivers/acpi/acpi_amba.c @@ -22,7 +22,6 @@ static const struct acpi_device_id amba_id_list[] = { {"ARMH0061", 0}, /* PL061 GPIO Device */ {"ARMH0330", 0}, /* ARM DMA Controller DMA-330 */ - {"ARMHC500", 0}, /* ARM CoreSight ETM4x */ {"ARMHC501", 0}, /* ARM CoreSight ETR */ {"ARMHC502", 0}, /* ARM CoreSight STM */ {"ARMHC503", 0}, /* ARM CoreSight Debug */ diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index 60f027e33aa0..fe494c9c6bad 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -3,6 +3,7 @@ * Copyright (c) 2014, The Linux Foundation. All rights reserved. */ +#include #include #include #include @@ -2344,12 +2345,21 @@ static const struct of_device_id etm4_match[] = { {} }; +#ifdef CONFIG_ACPI +static const struct acpi_device_id etm4x_acpi_ids[] = { + {"ARMHC500", 0}, /* ARM CoreSight ETM4x */ + {} +}; +MODULE_DEVICE_TABLE(acpi, etm4x_acpi_ids); +#endif + static struct platform_driver etm4_platform_driver = { .probe = etm4_probe_platform_dev, .remove = etm4_remove_platform_dev, .driver = { .name = "coresight-etm4x", .of_match_table = etm4_match, + .acpi_match_table = ACPI_PTR(etm4x_acpi_ids), .suppress_bind_attrs = true, }, }; From patchwork Fri Mar 17 03:05:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 71050 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp117854wrt; Thu, 16 Mar 2023 20:11:32 -0700 (PDT) X-Google-Smtp-Source: AK7set98EfIZiamPDiVGb0v6gU9OAoLx/GMukKOSibTtrxFLc4sAT0Lq1DKshvTpM3abUZufr2xU X-Received: by 2002:a92:cb4c:0:b0:315:9891:85d7 with SMTP id f12-20020a92cb4c000000b00315989185d7mr887390ilq.16.1679022692232; Thu, 16 Mar 2023 20:11:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679022692; cv=none; d=google.com; s=arc-20160816; b=cxoXZgjeff0lScD2bQmcCoAl1VjF48s/L5oSUASLPbk3Vm35O1+DjTLJXNJ76rXWb5 IIWchDinAv/FbrYdvg+IJ4WyCSJvkBTKMihSnlHkU6QwIDsW4NxMi9H1lgJNdnJK5xKi 8ytcred5BBsmNhgdF5pBYFV8Sel5AnSnNANVIHVkRF8yf5DIzL7NVOnVoIR0q8oGXRxz 6Dw1lphGFebWBvW/g6E7Xbip2Gzw1yb3n7uIQZfhiMtrT/VYVhmkWJq09FwSIaLHTT4h LxE2EqynXbYUrZlqJDKBFfRvid0pI6egiYtQQzuxpSfR4sEPFnrDl8+YAW7ODcVBCHtx 0r0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=tebm3XRXTkPIirCaUrLLTzOi8HiG+SZHUopngVfEwWg=; b=oeAnvmfl2waIf7sh3NW3Hbq9RNDda/ZemiqyFbAaTda1Bx1dLUTb64M8KWJ2QBCVBQ x4oZgZhJeJIT3xmkrlojdnj9RxB7rADHaqglzbNFsdPXPTZNQYQEeRjMGKgHJN2oWqjn gzM4JOs38MsC9thfKSBFqYeRUqp47qSqp31HNtmGHzCiLQSMQAHm3tXHaZZC6vnFnQ/r 4cWszdwaZZpAtQmWSnPkIhFMtyrNKVkJQA2CU6OTwfH9Z5Fs7kxRI3tHVyutgYuQXzW/ 8dMEJlUeylg1bx3pMB/7hNtxHrMF9klK92s2u56oH7yYAUnUK296eKDYoZEUa5QkppB0 TyYw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k7-20020a056e021a8700b00318d4c5ba39si1190577ilv.29.2023.03.16.20.11.17; Thu, 16 Mar 2023 20:11:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230044AbjCQDHA (ORCPT + 99 others); Thu, 16 Mar 2023 23:07:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229702AbjCQDGP (ORCPT ); Thu, 16 Mar 2023 23:06:15 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0425CB1ED1; Thu, 16 Mar 2023 20:06:00 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 826B24B3; Thu, 16 Mar 2023 20:06:43 -0700 (PDT) Received: from a077893.blr.arm.com (unknown [10.162.40.17]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C0DE63F64C; Thu, 16 Mar 2023 20:05:53 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, suzuki.poulose@arm.com Cc: scclevenger@os.amperecomputing.com, Anshuman Khandual , Rob Herring , Frank Rowand , Russell King , Greg Kroah-Hartman , "Rafael J. Wysocki" , Len Brown , Sudeep Holla , Lorenzo Pieralisi , Mathieu Poirier , Mike Leach , Leo Yan , devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/7] of/platform: Skip coresight etm4x devices from AMBA bus Date: Fri, 17 Mar 2023 08:35:00 +0530 Message-Id: <20230317030501.1811905-7-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230317030501.1811905-1-anshuman.khandual@arm.com> References: <20230317030501.1811905-1-anshuman.khandual@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760582898653630386?= X-GMAIL-MSGID: =?utf-8?q?1760582898653630386?= Allow other drivers to claim a device, disregarding the "priority" of "arm,primecell". e.g., CoreSight ETM4x devices could be accessed via MMIO (AMBA Bus) or via CPU system instructions. The CoreSight ETM4x platform driver can now handle both types of devices. In order to make sure the driver gets to handle the "MMIO based" devices, which always had the "arm,primecell" compatible, we have two options : 1) Remove the "arm,primecell" from the DTS. But this may be problematic for an older kernel without the support. 2) The other option is to allow OF code to "ignore" the arm,primecell priority for a selected list of compatibles. This would make sure that both older kernels and the new kernels work fine without breaking the functionality. The new DTS could always have the "arm,primecell" removed. This patch implements Option (2). Cc: Rob Herring Cc: Frank Rowand Cc: Russell King (Oracle) Cc: Greg Kroah-Hartman Cc: devicetree@vger.kernel.org Cc: linux-kernel@vger.kernel.org Co-developed-by: Suzuki Poulose Signed-off-by: Suzuki Poulose Signed-off-by: Anshuman Khandual --- drivers/of/platform.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/of/platform.c b/drivers/of/platform.c index b2bd2e783445..59ff1a38ccaa 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -325,6 +325,13 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l return NULL; } +static const struct of_device_id of_ignore_amba_table[] = { +#ifdef CONFIG_CORESIGHT_SOURCE_ETM4X + { .compatible = "arm,coresight-etm4x" }, +#endif + {} /* NULL terminated */ +}; + /** * of_platform_bus_create() - Create a device for a node and its children. * @bus: device node of the bus to instantiate @@ -373,7 +380,8 @@ static int of_platform_bus_create(struct device_node *bus, platform_data = auxdata->platform_data; } - if (of_device_is_compatible(bus, "arm,primecell")) { + if (of_device_is_compatible(bus, "arm,primecell") && + unlikely(!of_match_node(of_ignore_amba_table, bus))) { /* * Don't return an error here to keep compatibility with older * device tree files. From patchwork Fri Mar 17 03:05:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 71049 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp116975wrt; Thu, 16 Mar 2023 20:08:51 -0700 (PDT) X-Google-Smtp-Source: AK7set8V4AEXP0JLIlfjfnteY1H2uOtLFmsYCGdlfHLRHL3uo3vFrrrECwVM4iA/57j74fd5r1HI X-Received: by 2002:a17:90b:2241:b0:23d:83b:8c5f with SMTP id hk1-20020a17090b224100b0023d083b8c5fmr6577452pjb.29.1679022531234; Thu, 16 Mar 2023 20:08:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679022531; cv=none; d=google.com; s=arc-20160816; b=Rgn9iG4bnhg1dzlVHRUiaynGXsPGbfNKn9JJR+Wr/1HpP1oSHr9cv8T34SzjmPPGyx SYDIv1CXAusJhilf3s7wsnluYqUdoU8PkNDJpZLmzjuDx2eZgFEAEWLYi1TWID6vn76y +xMKI6u50plUwnBVBw89jHyQaBkfTqPrYk+szUMmAW5vaHr1JQYDn02IN2XbF1Ngfe+r H3BOFWrUkAuD5xxDWJAQV4XR9NI+zaisg4TfDVvMlHbiielpVxqc4YQciSXtEjh0ZmIp BYYekUiNN2o+sbK1JUJJwHPYojxHMtopYaQ6rIbZ5WRzTcOrAjP2OlfccGvoP5mcLy4P VR5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=zapKkKXv+3n3eO/oV4P65g8+cfDDAm90C7cg1u6CvT8=; b=UBSTNFVq44QktaV7pacCUMLO6Ri+bxZfI5Bu9qIfulbPTusia3ymQKCjkBD2VKAmkC f2u8+mAfxhCXZdKQIauzXV61vrrs6nSJLHHRes6g7mShq46ZrWnOGAaqNArAP7PCsP+2 Cd7MSkaQl+jHY+k8q3X1+aIIoYfXcQRGDiaQ2D/dKDl+p6E2oyTJL6O/jaDcJsZ2ysqS fqccE+Q0mK86j7DmAY9ttlEqkYr1DnCMHWUGO2zVQtT3WWLQvjWPY3wVkkfZwdqvsArV VKL33/98MtcdjPUryygzvqzzsjbrSoYBX9bH8v8SXer8rnvZfNR2Ay7imj/3D8hnZG3X Ia1g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pm9-20020a17090b3c4900b002344ef1a33esi862682pjb.98.2023.03.16.20.08.36; Thu, 16 Mar 2023 20:08:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229997AbjCQDHZ (ORCPT + 99 others); Thu, 16 Mar 2023 23:07:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229986AbjCQDG2 (ORCPT ); Thu, 16 Mar 2023 23:06:28 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 77FFAB1B03; Thu, 16 Mar 2023 20:06:09 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F0B3F1480; Thu, 16 Mar 2023 20:06:49 -0700 (PDT) Received: from a077893.blr.arm.com (unknown [10.162.40.17]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 53D3E3F64C; Thu, 16 Mar 2023 20:06:00 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, suzuki.poulose@arm.com Cc: scclevenger@os.amperecomputing.com, Anshuman Khandual , Rob Herring , Frank Rowand , Russell King , Greg Kroah-Hartman , "Rafael J. Wysocki" , Len Brown , Sudeep Holla , Lorenzo Pieralisi , Mathieu Poirier , Mike Leach , Leo Yan , devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 7/7] coresight: etm4x: Drop the AMBA driver Date: Fri, 17 Mar 2023 08:35:01 +0530 Message-Id: <20230317030501.1811905-8-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230317030501.1811905-1-anshuman.khandual@arm.com> References: <20230317030501.1811905-1-anshuman.khandual@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760582729823362579?= X-GMAIL-MSGID: =?utf-8?q?1760582729823362579?= MMIO based etm4x devices, represented with AMBA device tree entries are now detected and operated via the common platform driver. An explicit dedicated AMBA driver is no longer required, this just drops that off completely. Cc: Mathieu Poirier Cc: Suzuki K Poulose Cc: Mike Leach Cc: Leo Yan Cc: coresight@lists.linaro.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- .../coresight/coresight-etm4x-core.c | 89 ------------------- 1 file changed, 89 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index fe494c9c6bad..e15551355975 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -2119,32 +2119,6 @@ static int etm4_probe(struct device *dev) return etm4_add_coresight_dev(&init_arg); } -static int etm4_probe_amba(struct amba_device *adev, const struct amba_id *id) -{ - struct etmv4_drvdata *drvdata; - void __iomem *base; - struct device *dev = &adev->dev; - struct resource *res = &adev->res; - int ret; - - /* Validity for the resource is already checked by the AMBA core */ - base = devm_ioremap_resource(dev, res); - if (IS_ERR(base)) - return PTR_ERR(base); - - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); - if (!drvdata) - return -ENOMEM; - - drvdata->base = base; - dev_set_drvdata(dev, drvdata); - ret = etm4_probe(dev); - if (!ret) - pm_runtime_put(&adev->dev); - - return ret; -} - static int etm4_probe_platform_dev(struct platform_device *pdev) { struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -2205,15 +2179,6 @@ static int etm4_probe_cpu(unsigned int cpu) return 0; } -static struct amba_cs_uci_id uci_id_etm4[] = { - { - /* ETMv4 UCI data */ - .devarch = ETM_DEVARCH_ETMv4x_ARCH, - .devarch_mask = ETM_DEVARCH_ID_MASK, - .devtype = ETM_DEVTYPE_ETMv4x_ARCH, - } -}; - static void clear_etmdrvdata(void *info) { int cpu = *(int *)info; @@ -2253,14 +2218,6 @@ static int __exit etm4_remove_dev(struct etmv4_drvdata *drvdata) return 0; } -static void __exit etm4_remove_amba(struct amba_device *adev) -{ - struct etmv4_drvdata *drvdata = dev_get_drvdata(&adev->dev); - - if (drvdata) - etm4_remove_dev(drvdata); -} - static int __exit etm4_remove_platform_dev(struct platform_device *pdev) { int ret = 0; @@ -2276,42 +2233,6 @@ static int __exit etm4_remove_platform_dev(struct platform_device *pdev) return ret; } -static const struct amba_id etm4_ids[] = { - CS_AMBA_ID(0x000bb95d), /* Cortex-A53 */ - CS_AMBA_ID(0x000bb95e), /* Cortex-A57 */ - CS_AMBA_ID(0x000bb95a), /* Cortex-A72 */ - CS_AMBA_ID(0x000bb959), /* Cortex-A73 */ - CS_AMBA_UCI_ID(0x000bb9da, uci_id_etm4),/* Cortex-A35 */ - CS_AMBA_UCI_ID(0x000bbd05, uci_id_etm4),/* Cortex-A55 */ - CS_AMBA_UCI_ID(0x000bbd0a, uci_id_etm4),/* Cortex-A75 */ - CS_AMBA_UCI_ID(0x000bbd0c, uci_id_etm4),/* Neoverse N1 */ - CS_AMBA_UCI_ID(0x000bbd41, uci_id_etm4),/* Cortex-A78 */ - CS_AMBA_UCI_ID(0x000f0205, uci_id_etm4),/* Qualcomm Kryo */ - CS_AMBA_UCI_ID(0x000f0211, uci_id_etm4),/* Qualcomm Kryo */ - CS_AMBA_UCI_ID(0x000bb802, uci_id_etm4),/* Qualcomm Kryo 385 Cortex-A55 */ - CS_AMBA_UCI_ID(0x000bb803, uci_id_etm4),/* Qualcomm Kryo 385 Cortex-A75 */ - CS_AMBA_UCI_ID(0x000bb805, uci_id_etm4),/* Qualcomm Kryo 4XX Cortex-A55 */ - CS_AMBA_UCI_ID(0x000bb804, uci_id_etm4),/* Qualcomm Kryo 4XX Cortex-A76 */ - CS_AMBA_UCI_ID(0x000bbd0d, uci_id_etm4),/* Qualcomm Kryo 5XX Cortex-A77 */ - CS_AMBA_UCI_ID(0x000cc0af, uci_id_etm4),/* Marvell ThunderX2 */ - CS_AMBA_UCI_ID(0x000b6d01, uci_id_etm4),/* HiSilicon-Hip08 */ - CS_AMBA_UCI_ID(0x000b6d02, uci_id_etm4),/* HiSilicon-Hip09 */ - {}, -}; - -MODULE_DEVICE_TABLE(amba, etm4_ids); - -static struct amba_driver etm4x_amba_driver = { - .drv = { - .name = "coresight-etm4x", - .owner = THIS_MODULE, - .suppress_bind_attrs = true, - }, - .probe = etm4_probe_amba, - .remove = etm4_remove_amba, - .id_table = etm4_ids, -}; - #ifdef CONFIG_PM static int etm4_runtime_suspend(struct device *dev) { @@ -2374,27 +2295,17 @@ static int __init etm4x_init(void) if (ret) return ret; - ret = amba_driver_register(&etm4x_amba_driver); - if (ret) { - pr_err("Error registering etm4x AMBA driver\n"); - goto clear_pm; - } - ret = platform_driver_register(&etm4_platform_driver); if (!ret) return 0; pr_err("Error registering etm4x platform driver\n"); - amba_driver_unregister(&etm4x_amba_driver); - -clear_pm: etm4_pm_clear(); return ret; } static void __exit etm4x_exit(void) { - amba_driver_unregister(&etm4x_amba_driver); platform_driver_unregister(&etm4_platform_driver); etm4_pm_clear(); }