From patchwork Wed Mar 20 18:49:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 160727 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp627452jan; Wed, 20 Mar 2019 11:52:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqyFGnMli94PvkpIOATYE3njOavLDLnZPLN3NxrTqo33EcGdiEcLlEVldleY6l/4E5gu2iTV X-Received: by 2002:a17:902:e68e:: with SMTP id cn14mr9529109plb.67.1553107951953; Wed, 20 Mar 2019 11:52:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553107951; cv=none; d=google.com; s=arc-20160816; b=hhU1h6vAy05n0jRSq8xQRgN9tDWQfo+DSt7ppqPdLQt6GMBBhnm4EN0VPtL0+uumnA fiIJEunXr2o9D9UG54ufzEsAIl51CLfs1WKYkElrDyULfRlFMPGZQUC0AodKFU2vfcd3 Kz8LwaYHrmQP3lVwvWRfHb904YXAOFcw8EasVwUyk7d0zqM8QMqYpEyhFEJXFv23nwAq nt9Jlkpei9Ibz/p8tbE3ZBgpFBOL0DbAuSlIld1hMKVIRzEURi75ibaVuVIch3zYviUJ ZS07kp2Jf1xSdbvAtU0g6Vw747rN8dgUKt3e7M+D6/9Pvp+sEM2+ZQ3ZUD18tnzu7FIS Lz2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=BTP7rtpDLwTWW1seMzs0ICR2JzFa4zfvh3vevJfFYP0=; b=p23Ql72m6L9yDxVtpgeJ0qHbDiG3e+uL7VSL5x2kI59bfKkI7GBlLFmBOUSl/m8y9x 7QBfllYy1e3rxPcf44LjrxaZShd1io5th7Q/AWMIc5rPrWajqQHSKc6NvFS8ihayCNyy YcTORBE6buC25Nn1W8yOFonwdEuq+YSHMZInvQqOYpq7PjZfpOO4ClLWmK2peyO6Otlk QP64LwviNFSJJtE607+kUfN33+pYj9Jg6XD0RwTDFhryjhA2+JIOJ+rXC/YvD2QHCl5n VlvmtQiVnXnOvrgTXZgALBReNMZLJ4u3ckHAUWM21d+NX86j1iy1/yFw1AHRtw+ZamS5 2U0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t37si2229289pgl.137.2019.03.20.11.52.31; Wed, 20 Mar 2019 11:52:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727834AbfCTSwa (ORCPT + 31 others); Wed, 20 Mar 2019 14:52:30 -0400 Received: from foss.arm.com ([217.140.101.70]:44808 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727492AbfCTSuP (ORCPT ); Wed, 20 Mar 2019 14:50:15 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 58691174E; Wed, 20 Mar 2019 11:50:14 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D2D183F59C; Wed, 20 Mar 2019 11:50:12 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, coresight@lists.linaro.org, mike.leach@linaro.org, robert.walker@arm.com, Suzuki K Poulose , Mathieu Poirier Subject: [PATCH 03/25] coresight: replicator: Prepare for merging with dynamic-replicator Date: Wed, 20 Mar 2019 18:49:20 +0000 Message-Id: <1553107783-3340-4-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> References: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As a preparatory step to merge the separate drivers for static and dynamic replicators, annotate the static replicator specific details. Also refactor the probe routine to make it generic in order to merge the drivers easily. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-replicator.c | 62 +++++++++++++--------- 1 file changed, 36 insertions(+), 26 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c index feac983..43cbcf1 100644 --- a/drivers/hwtracing/coresight/coresight-replicator.c +++ b/drivers/hwtracing/coresight/coresight-replicator.c @@ -56,58 +56,68 @@ static const struct coresight_ops replicator_cs_ops = { .link_ops = &replicator_link_ops, }; -static int replicator_probe(struct platform_device *pdev) +static int replicator_probe(struct device *dev) { - int ret; - struct device *dev = &pdev->dev; + int ret = 0; struct coresight_platform_data *pdata = NULL; struct replicator_drvdata *drvdata; struct coresight_desc desc = { 0 }; - struct device_node *np = pdev->dev.of_node; + struct device_node *np = dev->of_node; if (np) { pdata = of_get_coresight_platform_data(dev, np); if (IS_ERR(pdata)) return PTR_ERR(pdata); - pdev->dev.platform_data = pdata; + dev->platform_data = pdata; } drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) return -ENOMEM; - drvdata->dev = &pdev->dev; - drvdata->atclk = devm_clk_get(&pdev->dev, "atclk"); /* optional */ + drvdata->dev = dev; + drvdata->atclk = devm_clk_get(dev, "atclk"); /* optional */ if (!IS_ERR(drvdata->atclk)) { ret = clk_prepare_enable(drvdata->atclk); if (ret) return ret; } - pm_runtime_get_noresume(&pdev->dev); - pm_runtime_set_active(&pdev->dev); - pm_runtime_enable(&pdev->dev); - platform_set_drvdata(pdev, drvdata); + + dev_set_drvdata(dev, drvdata); desc.type = CORESIGHT_DEV_TYPE_LINK; desc.subtype.link_subtype = CORESIGHT_DEV_SUBTYPE_LINK_SPLIT; desc.ops = &replicator_cs_ops; - desc.pdata = pdev->dev.platform_data; - desc.dev = &pdev->dev; + desc.pdata = dev->platform_data; + desc.dev = dev; drvdata->csdev = coresight_register(&desc); if (IS_ERR(drvdata->csdev)) { ret = PTR_ERR(drvdata->csdev); - goto out_disable_pm; + goto out_disable_clk; } - pm_runtime_put(&pdev->dev); + pm_runtime_put(dev); - return 0; - -out_disable_pm: - if (!IS_ERR(drvdata->atclk)) +out_disable_clk: + if (ret && !IS_ERR_OR_NULL(drvdata->atclk)) clk_disable_unprepare(drvdata->atclk); - pm_runtime_put_noidle(&pdev->dev); - pm_runtime_disable(&pdev->dev); + return ret; +} + +static int static_replicator_probe(struct platform_device *pdev) +{ + int ret; + + pm_runtime_get_noresume(&pdev->dev); + pm_runtime_set_active(&pdev->dev); + pm_runtime_enable(&pdev->dev); + + ret = replicator_probe(&pdev->dev); + + if (ret) { + pm_runtime_put_noidle(&pdev->dev); + pm_runtime_disable(&pdev->dev); + } return ret; } @@ -139,18 +149,18 @@ static const struct dev_pm_ops replicator_dev_pm_ops = { replicator_runtime_resume, NULL) }; -static const struct of_device_id replicator_match[] = { +static const struct of_device_id static_replicator_match[] = { {.compatible = "arm,coresight-replicator"}, {} }; -static struct platform_driver replicator_driver = { - .probe = replicator_probe, +static struct platform_driver static_replicator_driver = { + .probe = static_replicator_probe, .driver = { .name = "coresight-replicator", - .of_match_table = replicator_match, + .of_match_table = static_replicator_match, .pm = &replicator_dev_pm_ops, .suppress_bind_attrs = true, }, }; -builtin_platform_driver(replicator_driver); +builtin_platform_driver(static_replicator_driver); From patchwork Wed Mar 20 18:49:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 160726 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp627380jan; Wed, 20 Mar 2019 11:52:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqy4cby94fbU/e1DhwI5NDYU+ktRPQj811EihHlbLRrOF6pFscdFI/CkuMG8BasQKwustvV3 X-Received: by 2002:aa7:8a92:: with SMTP id a18mr9232946pfc.218.1553107946574; Wed, 20 Mar 2019 11:52:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553107946; cv=none; d=google.com; s=arc-20160816; b=w2iucu0v8v9hWHNiylGHGFiNqZ3bjnX0Icah10nzTMwlCioEmJpqPsLL49/tTlPaAA 17ETOaT+ItDlCGoDRErkbFOgARxXTuFbDXC3bdnMPCje/glG4dUblkUUYtTS+7U8Gckp 5/RrrM+m9YCkEWlFmqpxZV/OUYKmwMBPhb5ge18zYhJk0CkvXO0CmBHi1t7YuFRaKYFD /0B7fvQTYdMgHdpB5u/AWNWk0bZ1FEGCrPGA01L2DXuT9L3eHb3qRVllMvX7THX0jbnP wizqpZodn2/ZXFh77Gy3x+QuByfUx14ge1OLpvn8kSzFGqphkm8myxOqiNCXr3FoBWXT qjfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=LmJqWuMjfdque3x0IDlFQhRp5MzGQtTodELH3zmht+Q=; b=nejQ7PNhQtiG2+SvRTKCw7ltCxRjEv82JwFR+nOTT4Babfchiq4DHYCRM+vNNWPUCN VN6/KXgm6CtlcCEnjGJhOxt3xrpsR61VuQ+2q9geO1pU7DVc7XGeRuz54/f2UqNiTev4 pcupJKVxJp0U66svqeXhh6SEIzPc3IHnKVf9Sw2aOVnKrfaBTAR58GsUGyyUtpqGW3BH UjWDHcmQR1+Nx+ewu2/KZciIopk7kBhIKBtyj06ep+nDVVUk7cl5KPoCQkNRneg6bxqq zO/yxn3hZ95fICefncwVvVsheDLGDbw2b51nMQWPCTipOhx0yVZOpPDpVoyLDS2GZKSd mFZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s4si2201291pgs.566.2019.03.20.11.52.26; Wed, 20 Mar 2019 11:52:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727531AbfCTSuU (ORCPT + 31 others); Wed, 20 Mar 2019 14:50:20 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:44820 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727507AbfCTSuQ (ORCPT ); Wed, 20 Mar 2019 14:50:16 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1B1E0A78; Wed, 20 Mar 2019 11:50:16 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 9553D3F59C; Wed, 20 Mar 2019 11:50:14 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, coresight@lists.linaro.org, mike.leach@linaro.org, robert.walker@arm.com, Suzuki K Poulose , Mathieu Poirier Subject: [PATCH 04/25] coresight: dynamic-replicator: Prepare for merging with static replicator Date: Wed, 20 Mar 2019 18:49:21 +0000 Message-Id: <1553107783-3340-5-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> References: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Rename the dynamic replicator specific routines for merging with the replicator driver. Also re-arrange the probe routine to make it easier to merge. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- .../coresight/coresight-dynamic-replicator.c | 104 +++++++++++++-------- 1 file changed, 63 insertions(+), 41 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-dynamic-replicator.c b/drivers/hwtracing/coresight/coresight-dynamic-replicator.c index fe176b9..b7d7c41 100644 --- a/drivers/hwtracing/coresight/coresight-dynamic-replicator.c +++ b/drivers/hwtracing/coresight/coresight-dynamic-replicator.c @@ -21,13 +21,13 @@ #define REPLICATOR_IDFILTER1 0x004 /** - * struct replicator_state - specifics associated to a replicator component + * struct replicator_drvdata - specifics associated to a replicator component * @base: memory mapped base address for this component. * @dev: the device entity associated with this component * @atclk: optional clock for the core parts of the replicator. * @csdev: component vitals needed by the framework */ -struct replicator_state { +struct replicator_drvdata { void __iomem *base; struct device *dev; struct clk *atclk; @@ -35,9 +35,9 @@ struct replicator_state { }; /* - * replicator_reset : Reset the replicator configuration to sane values. + * dynamic_replicator_reset : Reset the replicator configuration to sane values. */ -static void replicator_reset(struct replicator_state *drvdata) +static void dynamic_replicator_reset(struct replicator_drvdata *drvdata) { CS_UNLOCK(drvdata->base); @@ -50,12 +50,11 @@ static void replicator_reset(struct replicator_state *drvdata) CS_LOCK(drvdata->base); } -static int replicator_enable(struct coresight_device *csdev, int inport, - int outport) +static int dynamic_replicator_enable(struct replicator_drvdata *drvdata, + int inport, int outport) { int rc = 0; u32 reg; - struct replicator_state *drvdata = dev_get_drvdata(csdev->dev.parent); switch (outport) { case 0: @@ -76,21 +75,28 @@ static int replicator_enable(struct coresight_device *csdev, int inport, rc = coresight_claim_device_unlocked(drvdata->base); /* Ensure that the outport is enabled. */ - if (!rc) { + if (!rc) writel_relaxed(0x00, drvdata->base + reg); - dev_dbg(drvdata->dev, "REPLICATOR enabled\n"); - } - CS_LOCK(drvdata->base); return rc; } -static void replicator_disable(struct coresight_device *csdev, int inport, - int outport) +static int replicator_enable(struct coresight_device *csdev, int inport, + int outport) +{ + int rc = 0; + struct replicator_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); + + rc = dynamic_replicator_enable(drvdata, inport, outport); + dev_dbg(drvdata->dev, "REPLICATOR enabled\n"); + return rc; +} + +static void dynamic_replicator_disable(struct replicator_drvdata *drvdata, + int inport, int outport) { u32 reg; - struct replicator_state *drvdata = dev_get_drvdata(csdev->dev.parent); switch (outport) { case 0: @@ -113,7 +119,14 @@ static void replicator_disable(struct coresight_device *csdev, int inport, (readl_relaxed(drvdata->base + REPLICATOR_IDFILTER1) == 0xff)) coresight_disclaim_device_unlocked(drvdata->base); CS_LOCK(drvdata->base); +} +static void replicator_disable(struct coresight_device *csdev, int inport, + int outport) +{ + struct replicator_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); + + dynamic_replicator_disable(drvdata, inport, outport); dev_dbg(drvdata->dev, "REPLICATOR disabled\n"); } @@ -127,7 +140,7 @@ static const struct coresight_ops replicator_cs_ops = { }; #define coresight_replicator_reg(name, offset) \ - coresight_simple_reg32(struct replicator_state, name, offset) + coresight_simple_reg32(struct replicator_drvdata, name, offset) coresight_replicator_reg(idfilter0, REPLICATOR_IDFILTER0); coresight_replicator_reg(idfilter1, REPLICATOR_IDFILTER1); @@ -148,52 +161,55 @@ static const struct attribute_group *replicator_groups[] = { NULL, }; -static int replicator_probe(struct amba_device *adev, const struct amba_id *id) +static int replicator_probe(struct device *dev, struct resource *res) { int ret = 0; - struct device *dev = &adev->dev; - struct resource *res = &adev->res; struct coresight_platform_data *pdata = NULL; - struct replicator_state *drvdata; + struct replicator_drvdata *drvdata; struct coresight_desc desc = { 0 }; - struct device_node *np = adev->dev.of_node; + struct device_node *np = dev->of_node; void __iomem *base; if (np) { pdata = of_get_coresight_platform_data(dev, np); if (IS_ERR(pdata)) return PTR_ERR(pdata); - adev->dev.platform_data = pdata; + dev->platform_data = pdata; } drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) return -ENOMEM; - drvdata->dev = &adev->dev; - drvdata->atclk = devm_clk_get(&adev->dev, "atclk"); /* optional */ + drvdata->dev = dev; + drvdata->atclk = devm_clk_get(dev, "atclk"); /* optional */ if (!IS_ERR(drvdata->atclk)) { ret = clk_prepare_enable(drvdata->atclk); if (ret) return ret; } - /* Validity for the resource is already checked by the AMBA core */ - base = devm_ioremap_resource(dev, res); - if (IS_ERR(base)) { - ret = PTR_ERR(base); - goto out_disable_clk; + /* + * Map the device base for dynamic-replicator, which has been + * validated by AMBA core + */ + if (res) { + base = devm_ioremap_resource(dev, res); + if (IS_ERR(base)) { + ret = PTR_ERR(base); + goto out_disable_clk; + } + drvdata->base = base; + desc.groups = replicator_groups; } - drvdata->base = base; dev_set_drvdata(dev, drvdata); desc.type = CORESIGHT_DEV_TYPE_LINK; desc.subtype.link_subtype = CORESIGHT_DEV_SUBTYPE_LINK_SPLIT; desc.ops = &replicator_cs_ops; - desc.pdata = adev->dev.platform_data; - desc.dev = &adev->dev; - desc.groups = replicator_groups; + desc.pdata = dev->platform_data; + desc.dev = dev; drvdata->csdev = coresight_register(&desc); if (IS_ERR(drvdata->csdev)) { @@ -201,8 +217,8 @@ static int replicator_probe(struct amba_device *adev, const struct amba_id *id) goto out_disable_clk; } - replicator_reset(drvdata); - pm_runtime_put(&adev->dev); + dynamic_replicator_reset(drvdata); + pm_runtime_put(dev); out_disable_clk: if (ret && !IS_ERR_OR_NULL(drvdata->atclk)) @@ -210,10 +226,16 @@ static int replicator_probe(struct amba_device *adev, const struct amba_id *id) return ret; } +static int dynamic_replicator_probe(struct amba_device *adev, + const struct amba_id *id) +{ + return replicator_probe(&adev->dev, &adev->res); +} + #ifdef CONFIG_PM static int replicator_runtime_suspend(struct device *dev) { - struct replicator_state *drvdata = dev_get_drvdata(dev); + struct replicator_drvdata *drvdata = dev_get_drvdata(dev); if (drvdata && !IS_ERR(drvdata->atclk)) clk_disable_unprepare(drvdata->atclk); @@ -223,7 +245,7 @@ static int replicator_runtime_suspend(struct device *dev) static int replicator_runtime_resume(struct device *dev) { - struct replicator_state *drvdata = dev_get_drvdata(dev); + struct replicator_drvdata *drvdata = dev_get_drvdata(dev); if (drvdata && !IS_ERR(drvdata->atclk)) clk_prepare_enable(drvdata->atclk); @@ -238,7 +260,7 @@ static const struct dev_pm_ops replicator_dev_pm_ops = { NULL) }; -static const struct amba_id replicator_ids[] = { +static const struct amba_id dynamic_replicator_ids[] = { { .id = 0x000bb909, .mask = 0x000fffff, @@ -251,13 +273,13 @@ static const struct amba_id replicator_ids[] = { { 0, 0 }, }; -static struct amba_driver replicator_driver = { +static struct amba_driver dynamic_replicator_driver = { .drv = { .name = "coresight-dynamic-replicator", .pm = &replicator_dev_pm_ops, .suppress_bind_attrs = true, }, - .probe = replicator_probe, - .id_table = replicator_ids, + .probe = dynamic_replicator_probe, + .id_table = dynamic_replicator_ids, }; -builtin_amba_driver(replicator_driver); +builtin_amba_driver(dynamic_replicator_driver); From patchwork Wed Mar 20 18:49:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 160705 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp625700jan; Wed, 20 Mar 2019 11:50:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqwgxcKl+/+SjGdJ0oKQ+BzH1ZOm+iPzHQuNxVOkQTm/253WnVClBmxm6UfM4+Nm7COp1LMf X-Received: by 2002:a65:60c7:: with SMTP id r7mr9056451pgv.37.1553107826521; Wed, 20 Mar 2019 11:50:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553107826; cv=none; d=google.com; s=arc-20160816; b=uYXmJfH+bB1qBCkc2ZK7yc5fkwC90EMgzxfaaSoO7waH7n/H7mIlZ8aOrRT5yjohFc H1AnMlqQ1r+vtvb4eTZux3laROaTNxbCFGVeusIMf6jasvaFYf1XwJohesoUZsWha1T7 zN9VTT4DGG9qQX1bkQ1WH7YPZ4uETJdu9zRzx7NZipMfD45DmvjbSrT608cj4EJqnlin 6KJXogMKK+ajlVrM7DeEMw33XxapBu1sUMlTx5wgPf0IM5kxGWCmIh5XW5B5V9udfkMc 7LaQyiyEN0NvFczTMkWJrQ8s42tRmJyCyadIkZ3MEJZaXRjXRpPeHrtj/eDXfm2P/VO/ 7ORQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=7KWAhN8DodSuchFa9XkBf7mwaIWhD1sNfVsiwoGh55c=; b=SB7BoJRdGvrekvg3nLhzRcrwfOYODbvCXB9b8m4jmF0BRtUnwUkbx6TIg90/64wBKd Q3NjaDdpgbw7yFgp0FaVVMLPNo8WZjUNbgJsXx8AWmhsbS/8n3V5F7L/G80Ey75YcJ2z XWPt8MeWNVxJkLtLMR4vfjUeEcu3nMJyafPUTJmReVMp6MQ7eHoRGcCIV5VUGnDXtcfG LcQ9ZlztQnZcTtU1Ay7bP8muC1hyslmbDbl41rVoEaqRu5pvaGswSl7ygmyUwCOAJr3v mjcqgeaBauyYuT6x+ulG8iPuMefcGUX7fQy6Mqb3O6hbKEMRMtPSbiFRaIJDHatJA6pc P68g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d1si2232925pgv.580.2019.03.20.11.50.26; Wed, 20 Mar 2019 11:50:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727555AbfCTSuX (ORCPT + 31 others); Wed, 20 Mar 2019 14:50:23 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:44854 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727251AbfCTSuU (ORCPT ); Wed, 20 Mar 2019 14:50:20 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B71A91A25; Wed, 20 Mar 2019 11:50:19 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 3D93A3F59C; Wed, 20 Mar 2019 11:50:18 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, coresight@lists.linaro.org, mike.leach@linaro.org, robert.walker@arm.com, Suzuki K Poulose , Mathieu Poirier Subject: [PATCH 06/25] coresight: funnel: Clean up device book keeping Date: Wed, 20 Mar 2019 18:49:23 +0000 Message-Id: <1553107783-3340-7-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> References: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In preparation to use a consistent device naming scheme, clean up the device link tracking in funnel driver. Use the "coresight" device instead of the "real" parent device for all internal purposes. All other requests (e.g, power management, DMA operations) must use the "real" device which is the parent device. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-funnel.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c index 9279251..1085f31 100644 --- a/drivers/hwtracing/coresight/coresight-funnel.c +++ b/drivers/hwtracing/coresight/coresight-funnel.c @@ -37,7 +37,6 @@ */ struct funnel_drvdata { void __iomem *base; - struct device *dev; struct clk *atclk; struct coresight_device *csdev; unsigned long priority; @@ -77,7 +76,7 @@ static int funnel_enable(struct coresight_device *csdev, int inport, rc = funnel_enable_hw(drvdata, inport); if (!rc) - dev_dbg(drvdata->dev, "FUNNEL inport %d enabled\n", inport); + dev_dbg(&csdev->dev, "FUNNEL inport %d enabled\n", inport); return rc; } @@ -105,7 +104,7 @@ static void funnel_disable(struct coresight_device *csdev, int inport, funnel_disable_hw(drvdata, inport); - dev_dbg(drvdata->dev, "FUNNEL inport %d disabled\n", inport); + dev_dbg(&csdev->dev, "FUNNEL inport %d disabled\n", inport); } static const struct coresight_ops_link funnel_link_ops = { @@ -160,11 +159,11 @@ static ssize_t funnel_ctrl_show(struct device *dev, u32 val; struct funnel_drvdata *drvdata = dev_get_drvdata(dev->parent); - pm_runtime_get_sync(drvdata->dev); + pm_runtime_get_sync(dev->parent); val = get_funnel_ctrl_hw(drvdata); - pm_runtime_put(drvdata->dev); + pm_runtime_put(dev->parent); return sprintf(buf, "%#x\n", val); } @@ -199,7 +198,6 @@ static int funnel_probe(struct amba_device *adev, const struct amba_id *id) if (!drvdata) return -ENOMEM; - drvdata->dev = &adev->dev; drvdata->atclk = devm_clk_get(&adev->dev, "atclk"); /* optional */ if (!IS_ERR(drvdata->atclk)) { ret = clk_prepare_enable(drvdata->atclk); From patchwork Wed Mar 20 18:49:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 160725 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp627302jan; Wed, 20 Mar 2019 11:52:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqzv7w+t95RrbyPA1/i/d93WYfH1s8Gz81Lqp+d5UsGdnmA3hg2R8u76Lwo2Hn9ompoKUtRv X-Received: by 2002:aa7:914f:: with SMTP id 15mr9121080pfi.49.1553107940288; Wed, 20 Mar 2019 11:52:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553107940; cv=none; d=google.com; s=arc-20160816; b=yPK5AFsomd4o3gxJYhROwdWXNxI5S6nCZ2Y0LV8GXFYnXfm81J8b6d4fNZyz0W1Vu/ tPi3bGZmNmwCPnTC7WQn00q8O5vpnVqUsZD0dcg5fXPG9KzqrOejreGFACGelsMuVAYW tod6WlJ+hiagn2SKQMwvy6ojw0NTo0RhWNv13P7N9vc+FRG5T4VNCd32f47N1yBAWP1x YL5h5zhOB86129/KRQKq8eMc3/3KoWh20ri7YLD63iM/Dy1kyC9tm4Tx46Wv2H45RmHX r0SVl+1E6gcrAUudxACIlHYZWrFkmYad37k3MZFrxLh5jGT0IYcbFwZGVA9Iy7xAyW0t iDTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=k3RpgrwJRXhrNdZWKbBI1nhiGZGFoJ6Dp6Z21SKkY9Q=; b=ZgJCbozUbVvbTUla1ScQqtUmFmFF3NZRxiSSQNbvHDKsiq3ZSjfkaZSBB7yb8Qu3rL AM/tTsFSFS1DGBh+kE3utkSDHTAzadZKCWQ6rtaAxtvuuNHO+5IcyccSKZepud0Q4YPE CHGYOsmVvBeMRIvWitOCp/bzf1t9CqVxeX7Y+uEhegWq2kB4R7CrClGwPI03V6BqUnkT Qz3v4A0+/V7sfJt3qO2yzWYHbUNCScLUuh99lIRIpktHZWRc2KCJHLRJKaNAfGqvDIOl XSUfMEc1gUjM5VYPAco/883mkO45OUqm1N4+4BF9vLJ3FZ6e3+nGf4/xg4bT50yFivNV JmPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r23si2176585pgv.406.2019.03.20.11.52.20; Wed, 20 Mar 2019 11:52:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727833AbfCTSwT (ORCPT + 31 others); Wed, 20 Mar 2019 14:52:19 -0400 Received: from foss.arm.com ([217.140.101.70]:44864 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727543AbfCTSuV (ORCPT ); Wed, 20 Mar 2019 14:50:21 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 79671174E; Wed, 20 Mar 2019 11:50:21 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id F3F153F59C; Wed, 20 Mar 2019 11:50:19 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, coresight@lists.linaro.org, mike.leach@linaro.org, robert.walker@arm.com, Suzuki K Poulose , Mathieu Poirier Subject: [PATCH 07/25] coresight: replicator: Cleanup device tracking Date: Wed, 20 Mar 2019 18:49:24 +0000 Message-Id: <1553107783-3340-8-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> References: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In preparation to use a consistent device naming scheme, clean up the device link tracking in replicator driver. Use the "coresight" device instead of the "real" parent device for all internal purposes. All other requests (e.g, power management, DMA operations) must use the "real" device which is the parent device. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-replicator.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c index 4e0da85..8bbb008 100644 --- a/drivers/hwtracing/coresight/coresight-replicator.c +++ b/drivers/hwtracing/coresight/coresight-replicator.c @@ -26,13 +26,11 @@ * struct replicator_drvdata - specifics associated to a replicator component * @base: memory mapped base address for this component. Also indicates * whether this one is programmable or not. - * @dev: the device entity associated with this component * @atclk: optional clock for the core parts of the replicator. * @csdev: component vitals needed by the framework */ struct replicator_drvdata { void __iomem *base; - struct device *dev; struct clk *atclk; struct coresight_device *csdev; }; @@ -100,7 +98,7 @@ static int replicator_enable(struct coresight_device *csdev, int inport, if (drvdata->base) rc = dynamic_replicator_enable(drvdata, inport, outport); if (!rc) - dev_dbg(drvdata->dev, "REPLICATOR enabled\n"); + dev_dbg(&csdev->dev, "REPLICATOR enabled\n"); return rc; } @@ -139,7 +137,7 @@ static void replicator_disable(struct coresight_device *csdev, int inport, if (drvdata->base) dynamic_replicator_disable(drvdata, inport, outport); - dev_dbg(drvdata->dev, "REPLICATOR disabled\n"); + dev_dbg(&csdev->dev, "REPLICATOR disabled\n"); } static const struct coresight_ops_link replicator_link_ops = { @@ -193,7 +191,6 @@ static int replicator_probe(struct device *dev, struct resource *res) if (!drvdata) return -ENOMEM; - drvdata->dev = dev; drvdata->atclk = devm_clk_get(dev, "atclk"); /* optional */ if (!IS_ERR(drvdata->atclk)) { ret = clk_prepare_enable(drvdata->atclk); From patchwork Wed Mar 20 18:49:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 160706 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp625746jan; Wed, 20 Mar 2019 11:50:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqzTVlfyPkwNy+ar2hurm0SO1n/x/PHohBVmWr4kI0X8HLuLLyUOqTVmZ2eNr7m5yexnpnM9 X-Received: by 2002:a17:902:f087:: with SMTP id go7mr9692290plb.121.1553107829573; Wed, 20 Mar 2019 11:50:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553107829; cv=none; d=google.com; s=arc-20160816; b=ZhXusm+o+6aCUq+YEHGCyWMqx2/7iFCKVAF7+LA/ji1NIiQeV2ncD6X0VugU5Yqrhn aPjWaICjbetgNbuxJyqHsAMSZokTvluOdNa8maE5SOnzK2yIr+teKzuvH07fraj+abuP 1rVUPU+nvY4S3nuYYQi7Jnmr3Z/hxoxvFmKWOlIVUzMLjQ2k2xzApQ2IQ11K51zswd1n p1IX1+y1hc6Ro26K9/A3HcXV8WVXfyVjv9ZehMf3jpTL5CqOB1C3pVLVrwZZpjPo1h93 F16Ztn2OUi/WC+Xn8VQwlBwyZqHxy070Ua5gLyA1D8DWTi5or5sjNwO8+sVetJX1rlmt OumA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=hQ4vDpT+2VGvCNMjGO5zXN0uM9dV2kHub2CH7ec4NZs=; b=vXcjziOFYG4sarpR3c1C08Osw76ZDrRu2Yn/UvnYhjoS2BgK6/UV6Oz6HmWzOg5sxz CFw8ZPdzVAFLx/s14u9BHURCdBqvWtTUrc8//aTMHApAXOlsmh1w9g5xhR7Oe9Ef5tGu 5ByxiZf56ZK5oW9ZE5W5pdyFn5ouEq55ZE+DAe/PyGZS79XE5DF/mhL1xTKuXAYKUva8 wrYZFb2XDCbc7DcQOV0eHFGiG09LX5i/fjNBZiR39Ja/q4BOUptSDfQsV1rXgy4/2e76 Hg528GbBRZ3VIo845jk81j7d02M9mXXDBSTJTkktUL2k4wT41/wAWKLh6fWSz8QR41Aj 4wZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d1si2232925pgv.580.2019.03.20.11.50.29; Wed, 20 Mar 2019 11:50:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727572AbfCTSu1 (ORCPT + 31 others); Wed, 20 Mar 2019 14:50:27 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:44878 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727385AbfCTSuX (ORCPT ); Wed, 20 Mar 2019 14:50:23 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3B6B7A78; Wed, 20 Mar 2019 11:50:23 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B60F13F59C; Wed, 20 Mar 2019 11:50:21 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, coresight@lists.linaro.org, mike.leach@linaro.org, robert.walker@arm.com, Suzuki K Poulose , Mathieu Poirier Subject: [PATCH 08/25] coresight: tmc: Clean up device specific data Date: Wed, 20 Mar 2019 18:49:25 +0000 Message-Id: <1553107783-3340-9-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> References: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In preparation to use a consistent device naming scheme, clean up the device link tracking in replicator driver. Use the "coresight" device instead of the "real" parent device for all internal purposes. All other requests (e.g, power management, DMA operations) must use the "real" device which is the parent device. Since the CATU driver also uses the TMC-SG infrastructure, update the callers to ensure they pass the appropriate device argument for the tables. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-catu.c | 5 ++--- drivers/hwtracing/coresight/coresight-tmc-etr.c | 26 ++++++++++++++----------- drivers/hwtracing/coresight/coresight-tmc.c | 22 ++++++++++----------- 3 files changed, 27 insertions(+), 26 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtracing/coresight/coresight-catu.c index 170fbb6..11c6f2f 100644 --- a/drivers/hwtracing/coresight/coresight-catu.c +++ b/drivers/hwtracing/coresight/coresight-catu.c @@ -328,19 +328,18 @@ static int catu_alloc_etr_buf(struct tmc_drvdata *tmc_drvdata, struct etr_buf *etr_buf, int node, void **pages) { struct coresight_device *csdev; - struct device *catu_dev; struct tmc_sg_table *catu_table; struct catu_etr_buf *catu_buf; csdev = tmc_etr_get_catu_device(tmc_drvdata); if (!csdev) return -ENODEV; - catu_dev = csdev->dev.parent; catu_buf = kzalloc(sizeof(*catu_buf), GFP_KERNEL); if (!catu_buf) return -ENOMEM; - catu_table = catu_init_sg_table(catu_dev, node, etr_buf->size, pages); + catu_table = catu_init_sg_table(&csdev->dev, node, + etr_buf->size, pages); if (IS_ERR(catu_table)) { kfree(catu_buf); return PTR_ERR(catu_table); diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index f684283..4152774 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -153,10 +153,11 @@ static void tmc_pages_free(struct tmc_pages *tmc_pages, struct device *dev, enum dma_data_direction dir) { int i; + struct device *real_dev = dev->parent; for (i = 0; i < tmc_pages->nr_pages; i++) { if (tmc_pages->daddrs && tmc_pages->daddrs[i]) - dma_unmap_page(dev, tmc_pages->daddrs[i], + dma_unmap_page(real_dev, tmc_pages->daddrs[i], PAGE_SIZE, dir); if (tmc_pages->pages && tmc_pages->pages[i]) __free_page(tmc_pages->pages[i]); @@ -184,6 +185,7 @@ static int tmc_pages_alloc(struct tmc_pages *tmc_pages, int i, nr_pages; dma_addr_t paddr; struct page *page; + struct device *real_dev = dev->parent; nr_pages = tmc_pages->nr_pages; tmc_pages->daddrs = kcalloc(nr_pages, sizeof(*tmc_pages->daddrs), @@ -207,8 +209,8 @@ static int tmc_pages_alloc(struct tmc_pages *tmc_pages, page = alloc_pages_node(node, GFP_KERNEL | __GFP_ZERO, 0); } - paddr = dma_map_page(dev, page, 0, PAGE_SIZE, dir); - if (dma_mapping_error(dev, paddr)) + paddr = dma_map_page(real_dev, page, 0, PAGE_SIZE, dir); + if (dma_mapping_error(real_dev, paddr)) goto err; tmc_pages->daddrs[i] = paddr; tmc_pages->pages[i] = page; @@ -295,7 +297,7 @@ static int tmc_alloc_data_pages(struct tmc_sg_table *sg_table, void **pages) * and data buffers. TMC writes to the data buffers and reads from the SG * Table pages. * - * @dev - Device to which page should be DMA mapped. + * @dev - Coresight device to which page should be DMA mapped. * @node - Numa node for mem allocations * @nr_tpages - Number of pages for the table entries. * @nr_dpages - Number of pages for Data buffer. @@ -339,13 +341,13 @@ void tmc_sg_table_sync_data_range(struct tmc_sg_table *table, { int i, index, start; int npages = DIV_ROUND_UP(size, PAGE_SIZE); - struct device *dev = table->dev; + struct device *real_dev = table->dev->parent; struct tmc_pages *data = &table->data_pages; start = offset >> PAGE_SHIFT; for (i = start; i < (start + npages); i++) { index = i % data->nr_pages; - dma_sync_single_for_cpu(dev, data->daddrs[index], + dma_sync_single_for_cpu(real_dev, data->daddrs[index], PAGE_SIZE, DMA_FROM_DEVICE); } } @@ -354,11 +356,11 @@ void tmc_sg_table_sync_data_range(struct tmc_sg_table *table, void tmc_sg_table_sync_table(struct tmc_sg_table *sg_table) { int i; - struct device *dev = sg_table->dev; + struct device *real_dev = sg_table->dev->parent; struct tmc_pages *table_pages = &sg_table->table_pages; for (i = 0; i < table_pages->nr_pages; i++) - dma_sync_single_for_device(dev, table_pages->daddrs[i], + dma_sync_single_for_device(real_dev, table_pages->daddrs[i], PAGE_SIZE, DMA_TO_DEVICE); } @@ -581,6 +583,7 @@ static int tmc_etr_alloc_flat_buf(struct tmc_drvdata *drvdata, void **pages) { struct etr_flat_buf *flat_buf; + struct device *real_dev = drvdata->dev->parent; /* We cannot reuse existing pages for flat buf */ if (pages) @@ -590,7 +593,7 @@ static int tmc_etr_alloc_flat_buf(struct tmc_drvdata *drvdata, if (!flat_buf) return -ENOMEM; - flat_buf->vaddr = dma_alloc_coherent(drvdata->dev, etr_buf->size, + flat_buf->vaddr = dma_alloc_coherent(real_dev, etr_buf->size, &flat_buf->daddr, GFP_KERNEL); if (!flat_buf->vaddr) { kfree(flat_buf); @@ -608,9 +611,10 @@ static int tmc_etr_alloc_flat_buf(struct tmc_drvdata *drvdata, static void tmc_etr_free_flat_buf(struct etr_buf *etr_buf) { struct etr_flat_buf *flat_buf = etr_buf->private; + struct device *real_dev = flat_buf->dev->parent; if (flat_buf && flat_buf->daddr) - dma_free_coherent(flat_buf->dev, flat_buf->size, + dma_free_coherent(real_dev, flat_buf->size, flat_buf->vaddr, flat_buf->daddr); kfree(flat_buf); } @@ -815,7 +819,7 @@ static struct etr_buf *tmc_alloc_etr_buf(struct tmc_drvdata *drvdata, struct etr_buf *etr_buf; has_etr_sg = tmc_etr_has_cap(drvdata, TMC_ETR_SG); - has_iommu = iommu_get_domain_for_dev(drvdata->dev); + has_iommu = iommu_get_domain_for_dev(drvdata->dev->parent); has_catu = !!tmc_etr_get_catu_device(drvdata); has_sg = has_catu || has_etr_sg; diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c index 647b6aa..9e7ff83 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.c +++ b/drivers/hwtracing/coresight/coresight-tmc.c @@ -330,24 +330,22 @@ const struct attribute_group *coresight_tmc_groups[] = { NULL, }; -static inline bool tmc_etr_can_use_sg(struct tmc_drvdata *drvdata) +static inline bool tmc_etr_can_use_sg(struct device *dev) { - return fwnode_property_present(drvdata->dev->fwnode, - "arm,scatter-gather"); + return fwnode_property_present(dev->fwnode, "arm,scatter-gather"); } /* Detect and initialise the capabilities of a TMC ETR */ -static int tmc_etr_setup_caps(struct tmc_drvdata *drvdata, - u32 devid, void *dev_caps) +static int tmc_etr_setup_caps(struct device *parent, u32 devid, void *dev_caps) { int rc; - u32 dma_mask = 0; + struct tmc_drvdata *drvdata = dev_get_drvdata(parent); /* Set the unadvertised capabilities */ tmc_etr_init_caps(drvdata, (u32)(unsigned long)dev_caps); - if (!(devid & TMC_DEVID_NOSCAT) && tmc_etr_can_use_sg(drvdata)) + if (!(devid & TMC_DEVID_NOSCAT) && tmc_etr_can_use_sg(parent)) tmc_etr_set_cap(drvdata, TMC_ETR_SG); /* Check if the AXI address width is available */ @@ -365,15 +363,15 @@ static int tmc_etr_setup_caps(struct tmc_drvdata *drvdata, case 44: case 48: case 52: - dev_info(drvdata->dev, "Detected dma mask %dbits\n", dma_mask); + dev_info(parent, "Detected dma mask %dbits\n", dma_mask); break; default: dma_mask = 40; } - rc = dma_set_mask_and_coherent(drvdata->dev, DMA_BIT_MASK(dma_mask)); + rc = dma_set_mask_and_coherent(parent, DMA_BIT_MASK(dma_mask)); if (rc) - dev_err(drvdata->dev, "Failed to setup DMA mask: %d\n", rc); + dev_err(parent, "Failed to setup DMA mask: %d\n", rc); return rc; } @@ -403,7 +401,6 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) if (!drvdata) goto out; - drvdata->dev = &adev->dev; dev_set_drvdata(dev, drvdata); /* Validity for the resource is already checked by the AMBA core */ @@ -448,7 +445,7 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) desc.type = CORESIGHT_DEV_TYPE_SINK; desc.subtype.sink_subtype = CORESIGHT_DEV_SUBTYPE_SINK_BUFFER; desc.ops = &tmc_etr_cs_ops; - ret = tmc_etr_setup_caps(drvdata, devid, + ret = tmc_etr_setup_caps(dev, devid, coresight_get_uci_data(id)); if (ret) goto out; @@ -470,6 +467,7 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) goto out; } + drvdata->dev = &drvdata->csdev->dev; drvdata->miscdev.name = pdata->name; drvdata->miscdev.minor = MISC_DYNAMIC_MINOR; drvdata->miscdev.fops = &tmc_fops; From patchwork Wed Mar 20 18:49:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 160724 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp627166jan; Wed, 20 Mar 2019 11:52:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqx/VTC+NKCPi02CqybMSbo+XSgIj983QUhqyfEtH3UUqKF0PzOq7AaDQw60HFvIr73lAklo X-Received: by 2002:aa7:92c1:: with SMTP id k1mr9186956pfa.246.1553107932335; Wed, 20 Mar 2019 11:52:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553107932; cv=none; d=google.com; s=arc-20160816; b=zI5Gf/pkOIJJxgQWTcQwnxG84a/nRK3LA571IIjmOWjKsiUhXnzLISAm+szLjkWmo5 SsSB/Q0dhAkE86GMuEE467jCqUjRmwsYm4I9rePJ0a+N9mQijz2xWAJmp4U+3ZDe5zep 9f7I26DRLyWXicJX7XwmmpJ37s0sQ54DHU6xhwjBovyjca5AJyHCv1i5v9jp1nEiDPFn m+4V2LVEGZt+YPFYxqYCM410oRcYka2EfOTtX2Jeqz8OxSEltJgePg+7uRPT+Gn/yVVm qEY74rx9yg5zxuVrCv6t2uuzJKdDQbXkv+ptq/yYt3Gv4dNg0r9qawCZo5g6fulyhyVs gg5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=GSWBLLDl+wmICugGAjf3tTlw/U0qJCDn6hLDb+xuTos=; b=J5BYOF+DDLAmmqmBJ3pu36ZbRoFRx5rzS0gy8zTRks/qVcFdSwmQMIlK6gnxidn5ce YGIWkrqdpiHF74mTOQKRloy59267o2Jw3Ozy8C30dRNaBWos/ApworKuVnDuECtscN4c KDTQdsRHNdSOvLstDb2z4tfeF9JY+b1BOEPlJxBTO9XBQtruJ4YYiIeVJvVrsKaToyMo VH0GIwEbWO3W8j9sok952NlQAEtcoBWRRX28KGVLiknOD69YQvGL13CqH5Hi3rotqr3P NAYcqLkKKJSfInHGemqgqx1lVtKRJRR8ChrByhFexDefJUswItPfttD85oSDQx1i9bTQ JAEA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f73si2251341pff.184.2019.03.20.11.52.12; Wed, 20 Mar 2019 11:52:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727569AbfCTSwK (ORCPT + 31 others); Wed, 20 Mar 2019 14:52:10 -0400 Received: from foss.arm.com ([217.140.101.70]:44888 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727558AbfCTSuZ (ORCPT ); Wed, 20 Mar 2019 14:50:25 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F17DB174E; Wed, 20 Mar 2019 11:50:24 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 781C23F59C; Wed, 20 Mar 2019 11:50:23 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, coresight@lists.linaro.org, mike.leach@linaro.org, robert.walker@arm.com, Suzuki K Poulose , Mathieu Poirier Subject: [PATCH 09/25] coresight: catu: Cleanup device specific data Date: Wed, 20 Mar 2019 18:49:26 +0000 Message-Id: <1553107783-3340-10-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> References: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Switch to using the CoreSight device instead of the real amba device. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-catu.c | 13 +++++++------ drivers/hwtracing/coresight/coresight-catu.h | 1 - 2 files changed, 7 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtracing/coresight/coresight-catu.c index 11c6f2f..671a05a 100644 --- a/drivers/hwtracing/coresight/coresight-catu.c +++ b/drivers/hwtracing/coresight/coresight-catu.c @@ -408,13 +408,14 @@ static int catu_enable_hw(struct catu_drvdata *drvdata, void *data) int rc; u32 control, mode; struct etr_buf *etr_buf = data; + struct device *dev = &drvdata->csdev->dev; if (catu_wait_for_ready(drvdata)) - dev_warn(drvdata->dev, "Timeout while waiting for READY\n"); + dev_warn(dev, "Timeout while waiting for READY\n"); control = catu_read_control(drvdata); if (control & BIT(CATU_CONTROL_ENABLE)) { - dev_warn(drvdata->dev, "CATU is already enabled\n"); + dev_warn(dev, "CATU is already enabled\n"); return -EBUSY; } @@ -440,7 +441,7 @@ static int catu_enable_hw(struct catu_drvdata *drvdata, void *data) catu_write_irqen(drvdata, 0); catu_write_mode(drvdata, mode); catu_write_control(drvdata, control); - dev_dbg(drvdata->dev, "Enabled in %s mode\n", + dev_dbg(dev, "Enabled in %s mode\n", (mode == CATU_MODE_PASS_THROUGH) ? "Pass through" : "Translate"); @@ -461,15 +462,16 @@ static int catu_enable(struct coresight_device *csdev, void *data) static int catu_disable_hw(struct catu_drvdata *drvdata) { int rc = 0; + struct device *dev = &drvdata->csdev->dev; catu_write_control(drvdata, 0); coresight_disclaim_device_unlocked(drvdata->base); if (catu_wait_for_ready(drvdata)) { - dev_info(drvdata->dev, "Timeout while waiting for READY\n"); + dev_info(dev, "Timeout while waiting for READY\n"); rc = -EAGAIN; } - dev_dbg(drvdata->dev, "Disabled\n"); + dev_dbg(dev, "Disabled\n"); return rc; } @@ -519,7 +521,6 @@ static int catu_probe(struct amba_device *adev, const struct amba_id *id) goto out; } - drvdata->dev = dev; dev_set_drvdata(dev, drvdata); base = devm_ioremap_resource(dev, &adev->res); if (IS_ERR(base)) { diff --git a/drivers/hwtracing/coresight/coresight-catu.h b/drivers/hwtracing/coresight/coresight-catu.h index 1b281f0..96ea8c4 100644 --- a/drivers/hwtracing/coresight/coresight-catu.h +++ b/drivers/hwtracing/coresight/coresight-catu.h @@ -61,7 +61,6 @@ #define CATU_IRQEN_OFF 0x0 struct catu_drvdata { - struct device *dev; void __iomem *base; struct coresight_device *csdev; int irq; From patchwork Wed Mar 20 18:49:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 160723 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp627015jan; Wed, 20 Mar 2019 11:52:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqz0WVXbqTesQXxHCYkgqTPfPEOCHhr72woawafv2HLhoQaRwYuCfOJVcVamYeaEM54BjXWQ X-Received: by 2002:a17:902:801:: with SMTP id 1mr9274537plk.299.1553107921378; Wed, 20 Mar 2019 11:52:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553107921; cv=none; d=google.com; s=arc-20160816; b=sP+gWJ4i2CPDZyrV5naplg+1McKf9NNXdh+Ykz3h8NJdCwdXQWYcxRM8sYDd9x40rR +eu83PGwN+UHChswT1Y+heO8puMf+BsDGZz8GFUOXdgYr+MwwBZV/5gWHTuGX3Al8byN UAqMiLsIW/5an3jxYn42+rgYUypEucT72Qwji7UFnrw3NU4+jYvzrDnnKY8QzWvuAGjA 6hbbQMMzCU3hWi8D0oVxG7Akq3xXBK9R8eAORg3KC+AwSTklauvxY/Ncu+cxp7rs56cq YfGokZo3Gll+IRtNc4O3pSOOIqvzXNd5d6HP5+TZcS+En+izGhwWQkXGZtFqxXqA45V3 BZFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=mPztbLJDmPagAmokCBWswRbEbkNpu1zgE6BtPsC5piU=; b=hHqDgTfW1EGIYRZ1VLtqsWhA0K+TVDHXu6LMHCR9ZEanIVFXPWXlWySrc4kFUk6emg AtIG0IaFJgARoUxEwQK28IwiSkbzSHfimdTJXY/BMn6ItK48q5ySnVY2B10H2FSRFqnO TzOQFHyDD5xMY+Xdk3euJKI3gQTj5dGVkX5aGYywD0SW+lCIvaDVLzlsoX1amfohT4b0 FcDT3ydvTnquW2WJ0qtXohfGJ1G/oOaGdMMBhVi/9XwqebxI7tV6ugCVER0/x75PTg9D cUHqUKCshoJqzGfGbRswTcZJLmDwRyHn7ncvNZdact5Ad+SUt1New9b82SeMqCTnSF+N f4dA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h6si818239pfn.13.2019.03.20.11.52.01; Wed, 20 Mar 2019 11:52:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727811AbfCTSwA (ORCPT + 31 others); Wed, 20 Mar 2019 14:52:00 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:44896 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727567AbfCTSu1 (ORCPT ); Wed, 20 Mar 2019 14:50:27 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B42FB168F; Wed, 20 Mar 2019 11:50:26 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 3A3933F59C; Wed, 20 Mar 2019 11:50:25 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, coresight@lists.linaro.org, mike.leach@linaro.org, robert.walker@arm.com, Suzuki K Poulose , Mathieu Poirier Subject: [PATCH 10/25] coresight: tpiu: Clean up device specific data Date: Wed, 20 Mar 2019 18:49:27 +0000 Message-Id: <1553107783-3340-11-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> References: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Switch to using the coresight device instead of the parent amba device. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-tpiu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c index b2f72a1..9763721 100644 --- a/drivers/hwtracing/coresight/coresight-tpiu.c +++ b/drivers/hwtracing/coresight/coresight-tpiu.c @@ -48,15 +48,13 @@ /** * @base: memory mapped base address for this component. - * @dev: the device entity associated to this component. + * @dev: the coresight device entity associated to this component. * @atclk: optional clock for the core parts of the TPIU. - * @csdev: component vitals needed by the framework. */ struct tpiu_drvdata { void __iomem *base; struct device *dev; struct clk *atclk; - struct coresight_device *csdev; }; static void tpiu_enable_hw(struct tpiu_drvdata *drvdata) @@ -121,6 +119,7 @@ static int tpiu_probe(struct amba_device *adev, const struct amba_id *id) struct tpiu_drvdata *drvdata; struct resource *res = &adev->res; struct coresight_desc desc = { 0 }; + struct coresight_device *csdev; struct device_node *np = adev->dev.of_node; if (np) { @@ -134,7 +133,6 @@ static int tpiu_probe(struct amba_device *adev, const struct amba_id *id) if (!drvdata) return -ENOMEM; - drvdata->dev = &adev->dev; drvdata->atclk = devm_clk_get(&adev->dev, "atclk"); /* optional */ if (!IS_ERR(drvdata->atclk)) { ret = clk_prepare_enable(drvdata->atclk); @@ -160,9 +158,11 @@ static int tpiu_probe(struct amba_device *adev, const struct amba_id *id) desc.ops = &tpiu_cs_ops; desc.pdata = pdata; desc.dev = dev; - drvdata->csdev = coresight_register(&desc); + csdev = coresight_register(&desc); + if (!IS_ERR(csdev)) + drvdata->dev = &csdev->dev; - return PTR_ERR_OR_ZERO(drvdata->csdev); + return PTR_ERR_OR_ZERO(csdev); } #ifdef CONFIG_PM From patchwork Wed Mar 20 18:49:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 160722 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp626955jan; Wed, 20 Mar 2019 11:51:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqw1HubnI0Oju6vHw4H1EAOE0UyfT/P4DJ2WsFvlfFFJlHHEOtQ2aB3FhLLeX/f/hGygRZ+9 X-Received: by 2002:a65:6489:: with SMTP id e9mr8781935pgv.260.1553107916157; Wed, 20 Mar 2019 11:51:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553107916; cv=none; d=google.com; s=arc-20160816; b=cL/ajhx5WpIqXTIreR4osh+bx5RWNouQ+hM5HWPS9v5O3o8QLaPuPpckQoChyNhWT2 xdgGUpGrHnw84sKmPvRYLf/aiyIvJ74svYdXxLcmTp3HVpyJleKMl080aV0F9sCHworF bj1UVQmdbIxXyq+FF24QwZHBoUaAS0QLYVzK+pHkLJFnJOr76cHQHH5fZz8S+lSsy9UK ge2aiLiideDTGEGAvifG29lq9D/dS2HsPBc5Y3B++l3yghpoy2GhOZqSHI9PX0H8akz9 k/6mt6TBKjzskd4/njsDnk77zo9HBwiKPUE6ugdLJ5ARWjsLcIQ1SDMCCcsoeafu4YuV L43A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=l/I07nCsy3hy/cIFaDIhTBYtMuwTfdLWlXZ6iKQSlw8=; b=hpqjYazPD0eDZ6Gk86r9lyW7PVzjEEV+CUX3uipRxb2NB5M3MVfhiKvIYo9+psbH75 q8V+6p1WBRc6RpSeDGPAX+rNxhNwOgzGyLQNjwgeJnKLRN90yWiitF4+LCnCR+V4DB0Y kRkHzR3Br68iliSHMY7ZEyrzfN+LOuNLoJQ+yRxr92kOocc31JUhA7+pscxjVCcM2i02 M4JGMVuFeYxfFCWNiKlrCNV+uCRx3eT88+1fCa15CnIQacPjxJowULE4E3rNDvARLzXt 7n35XQuMAe45QH3uqy0TkiFG7m6dflyoulXyV9q6o8Rj28AOY1ycDkNVpvZQfuL3BJZR fQnw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1si2575835plw.242.2019.03.20.11.51.55; Wed, 20 Mar 2019 11:51:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727805AbfCTSvy (ORCPT + 31 others); Wed, 20 Mar 2019 14:51:54 -0400 Received: from foss.arm.com ([217.140.101.70]:44920 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727577AbfCTSua (ORCPT ); Wed, 20 Mar 2019 14:50:30 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3956A1AC1; Wed, 20 Mar 2019 11:50:30 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B3CFF3F59C; Wed, 20 Mar 2019 11:50:28 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, coresight@lists.linaro.org, mike.leach@linaro.org, robert.walker@arm.com, Suzuki K Poulose , Mathieu Poirier Subject: [PATCH 12/25] coresight: etm: Clean up device specific data Date: Wed, 20 Mar 2019 18:49:29 +0000 Message-Id: <1553107783-3340-13-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> References: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Track the coresight device instead of the real device. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-etm3x.c | 6 +++--- drivers/hwtracing/coresight/coresight-etm4x.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c index be302ec..1b9ae3a 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x.c +++ b/drivers/hwtracing/coresight/coresight-etm3x.c @@ -462,7 +462,7 @@ int etm_get_trace_id(struct etm_drvdata *drvdata) if (!local_read(&drvdata->mode)) return drvdata->traceid; - pm_runtime_get_sync(drvdata->dev); + pm_runtime_get_sync(drvdata->dev->parent); spin_lock_irqsave(&drvdata->spinlock, flags); @@ -471,7 +471,7 @@ int etm_get_trace_id(struct etm_drvdata *drvdata) CS_LOCK(drvdata->base); spin_unlock_irqrestore(&drvdata->spinlock, flags); - pm_runtime_put(drvdata->dev); + pm_runtime_put(drvdata->dev->parent); out: return trace_id; @@ -803,7 +803,6 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id) drvdata->use_cp14 = of_property_read_bool(np, "arm,cp14"); } - drvdata->dev = &adev->dev; dev_set_drvdata(dev, drvdata); /* Validity for the resource is already checked by the AMBA core */ @@ -864,6 +863,7 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id) goto err_arch_supported; } + drvdata->dev = &drvdata->csdev->dev; ret = etm_perf_symlink(drvdata->csdev, true); if (ret) { coresight_unregister(drvdata->csdev); diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index 08ce37c..8d5ee3b 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -987,7 +987,6 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) adev->dev.platform_data = pdata; } - drvdata->dev = &adev->dev; dev_set_drvdata(dev, drvdata); /* Validity for the resource is already checked by the AMBA core */ @@ -1042,6 +1041,7 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) goto err_arch_supported; } + drvdata->dev = &drvdata->csdev->dev; ret = etm_perf_symlink(drvdata->csdev, true); if (ret) { coresight_unregister(drvdata->csdev); @@ -1049,7 +1049,7 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) } pm_runtime_put(&adev->dev); - dev_info(dev, "CPU%d: ETM v%d.%d initialized\n", + dev_info(drvdata->dev, "CPU%d: ETM v%d.%d initialized\n", drvdata->cpu, drvdata->arch >> 4, drvdata->arch & 0xf); if (boot_enable) { From patchwork Wed Mar 20 18:49:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 160708 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp625828jan; Wed, 20 Mar 2019 11:50:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqzbtOAftFB8xbIY9xRF/Li1JTgoTePD4CwCf7E+T/+ho4aq6nfpcjwV3dmW0NH+GZ5Xz8bh X-Received: by 2002:a17:902:9a88:: with SMTP id w8mr9573215plp.8.1553107837079; Wed, 20 Mar 2019 11:50:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553107837; cv=none; d=google.com; s=arc-20160816; b=YvQwfH79OgUGLpbi2eYd5Jrg+yipel3EDsSsM0eY/ITNmBjxFigFlAOo0SzlGxTuIV L+Y+19zBjtItPZDi8+WWU4MQh0xapc1SpPZDUGb/htKUD8LKnJq/WQjvFuOe4Mh1NqAu 32xzAaY6U2W7R1KqjAF4+/8YK3VPjcBX/+lDFDG6mXquaeLaE3GqJ5GsWZu4/IUCaMww pf16yQFdwadM0eOdQ8bxmHMu6OIEop65aVzj15Y04CldlAbtAtz+HxEihZPOqyH8mw8o rtLBTKnUYp5H6RDNaJlSzk94kYQN6M68ITIxNXwIDOCop1v8bgpdODLkVwz18EjJlKRl cYvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=p9idP47SCdDpv+b0+MksSMgmnvchtCTDHNla8PtqHmE=; b=LnvoVPNKLGYckLepPZKm0SF1dIZtoOBsvsghaxdYk0Ahj5R8jIsqg4sSPj5fg9xA27 4aZwI9N4ynjQd2UddpXOQ8z2nuIKZKfBU1DQWrZEhfpZVtB1QPoUg8DHO/rZeH4NyedW A5P5lNKKu+CIRji751dWmfijdKX+e0Cs5aL7ze5bTwns4tdg60XYnGra4BfDUhucv/RQ 6PlVgv+kE+vtw4tQSC1NmvR56ZSfWw0D9lvw03XJR7oclEgvRi2mQRwer2f5r2MunpaK PIGxmopun8p7DmWIFi2wLPD9W8/oVrA6F3+71wX2Ru43e5HU4RAkcDevIY2g9GVD2YZq rFCA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n19si2193801pgk.158.2019.03.20.11.50.36; Wed, 20 Mar 2019 11:50:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727607AbfCTSuf (ORCPT + 31 others); Wed, 20 Mar 2019 14:50:35 -0400 Received: from foss.arm.com ([217.140.101.70]:44930 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727590AbfCTSuc (ORCPT ); Wed, 20 Mar 2019 14:50:32 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F004FA78; Wed, 20 Mar 2019 11:50:31 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 769A03F59C; Wed, 20 Mar 2019 11:50:30 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, coresight@lists.linaro.org, mike.leach@linaro.org, robert.walker@arm.com, Suzuki K Poulose , Mathieu Poirier Subject: [PATCH 13/25] coresight: etb10: Clean up device specific data Date: Wed, 20 Mar 2019 18:49:30 +0000 Message-Id: <1553107783-3340-14-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> References: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Track the coresight device instead of the real device. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-etb10.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index 105782e..a471cbd 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -97,12 +97,12 @@ static unsigned int etb_get_buffer_depth(struct etb_drvdata *drvdata) { u32 depth = 0; - pm_runtime_get_sync(drvdata->dev); + pm_runtime_get_sync(drvdata->dev->parent); /* RO registers don't need locking */ depth = readl_relaxed(drvdata->base + ETB_RAM_DEPTH_REG); - pm_runtime_put(drvdata->dev); + pm_runtime_put(drvdata->dev->parent); return depth; } @@ -701,7 +701,6 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id) if (!drvdata) return -ENOMEM; - drvdata->dev = &adev->dev; drvdata->atclk = devm_clk_get(&adev->dev, "atclk"); /* optional */ if (!IS_ERR(drvdata->atclk)) { ret = clk_prepare_enable(drvdata->atclk); @@ -740,6 +739,7 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id) if (IS_ERR(drvdata->csdev)) return PTR_ERR(drvdata->csdev); + drvdata->dev = &drvdata->csdev->dev; drvdata->miscdev.name = pdata->name; drvdata->miscdev.minor = MISC_DYNAMIC_MINOR; drvdata->miscdev.fops = &etb_fops; From patchwork Wed Mar 20 18:49:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 160720 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp626677jan; Wed, 20 Mar 2019 11:51:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqxn1YQuP/Tg/Oyw1w+MEwshilnFRc894NPEfkNRBpNYfVMLrreWaTGZOMliHAT/9xKxaY2+ X-Received: by 2002:a63:65c4:: with SMTP id z187mr8985308pgb.102.1553107896980; Wed, 20 Mar 2019 11:51:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553107896; cv=none; d=google.com; s=arc-20160816; b=OpkFBhHUXiciufDlpSxCLdp7Go0q10NkyDK0IoiUuITmHUOBo/ZvySOrlBEsMzEI86 N0MEbHJmuG7QaUcXuDCDFlFPUCDF+Zm6QM8KltUDgGZhYSxtaxsXWSJRjGgFnaE+vXNE cQDES5bLCWbmCtu225bCmcyRFtjjzoUKpAvG9Bfq5ia5cbw1S7456rQityH8yGGl9kFk 5VxL2Yy1Vao+IY7t6jLFqOUKMbOx9/hv5/GYaWDHHQt3R8TieLuuAJOQ7YpfZheMmwbc PjtUwy23hxntrzbc3VYBWUyz1PvNWviCXaJhE89D0678gbX7KycP20Sr4XIEZRNr3jS0 zB4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=sREWSZSO0GfmHhdsjzo6kMF7cOxIAHxKPq4gnX1iPYQ=; b=cmITIAFa7VDWfO7S1YDmVliSFgwTZsAjLTQ6ybrckadxDu4dwPBgQNtjT16BA/8SAR fOd/OHWAPTysQR+VdiHb/eHthfGH9U+DczP39FzQ/imwZMAHC8C4s8YLXgLrf7IiAB4n CQHzZ+k6VYBhkJqRH2rNclYioOQ8FJ09Hyg/zrSc5B5bHvwSkRrBRrDdDuVrQ5RXW4/B lPmFyqWNzDkCNoeI75VMoDaSA8uWEuvflPL2yzxo50oYieyM7dvDJ5Fx+S7//C1dlVKs +O/2lh5h3MtBBWrMuR0yBmayv3U52oZDoFPkzxhdB7fAgr0Br6LpVDzxdOl6ZDdlFNQs yiNw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a22si2261680pfn.155.2019.03.20.11.51.36; Wed, 20 Mar 2019 11:51:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727628AbfCTSuj (ORCPT + 31 others); Wed, 20 Mar 2019 14:50:39 -0400 Received: from foss.arm.com ([217.140.101.70]:44956 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727609AbfCTSuf (ORCPT ); Wed, 20 Mar 2019 14:50:35 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7E20D174E; Wed, 20 Mar 2019 11:50:35 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id EF6F73F59C; Wed, 20 Mar 2019 11:50:33 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, coresight@lists.linaro.org, mike.leach@linaro.org, robert.walker@arm.com, Suzuki K Poulose , Mathieu Poirier Subject: [PATCH 15/25] coresight: etm3x: Rearrange cp14 access detection Date: Wed, 20 Mar 2019 18:49:32 +0000 Message-Id: <1553107783-3340-16-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> References: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As we are about to about refactor the platform specific handling, move the DT property handling to generic helpers. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-etm3x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c index 1b9ae3a..7137f06 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x.c +++ b/drivers/hwtracing/coresight/coresight-etm3x.c @@ -800,9 +800,9 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id) return PTR_ERR(pdata); adev->dev.platform_data = pdata; - drvdata->use_cp14 = of_property_read_bool(np, "arm,cp14"); } + drvdata->use_cp14 = fwnode_property_read_bool(dev->fwnode, "arm,cp14"); dev_set_drvdata(dev, drvdata); /* Validity for the resource is already checked by the AMBA core */ From patchwork Wed Mar 20 18:49:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 160709 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp625886jan; Wed, 20 Mar 2019 11:50:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqxWpv/9axEntO6XU2w7NlYZW17p8jUGMOIFbiHNzZRFtegzYDO4Qn145ivIOlE7kQowPFNJ X-Received: by 2002:a62:1b84:: with SMTP id b126mr9013917pfb.225.1553107840939; Wed, 20 Mar 2019 11:50:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553107840; cv=none; d=google.com; s=arc-20160816; b=hld3XfVjPwLrn1pXS8ALLOiggitLMRqrnIQRqznrAWAiGTikTiv6py3AbEH/8Qs1uw T9KWl+0vxTC36+SUaN0famVaJ4hHeXBWFwH6zhi3EyQ6k0xKWwsLWHabRZCckMvJEGfo i0kwvDFcQH6Ye5dLrstuUZaSRwqJO8VhfGUrSfkog9dMjaj1WwggEE8EMZI0amAsLion Xos1jG0YClqSd8tpHXw+dIxnRcD01cw3ylIopQlB1cNFut4U1puIKF9u7FHrnoetQKhN dVLa+5w2y4XRgSsEsqdrrRfr1fOWbrJFKh2ZpOxdAyhxKYqg3S52XvZmrnNed9lFc1bX /wog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=ZaCXV5BjcspCnrZBpWW74WxaJw3mJBmGZRTKKUqWdrE=; b=zWWB+pWVS4mVaosr47Ag/adw4LcBBMXQpAPw3Sx9XIjVt97d7mfmCR/u8RAQOdWoj7 t+WLRNcObEwhI0NJjqztWDgX41ZrPloRPMFxyGlOM5NDRaBWiEpt4OmAg0KPVNAdzCPW js2J5NlDmk4+3rvhAZr65rvvEd4Kys4N32JaHUTUhmkOVdr75G/nQ5U0EA8Pz/MhtQwI QfvchYWgU4imPKuZxNV0Ac/LKo60fxeCbzr3yGT8M1Ztj4j6PJxMCGZDavNLQdWTblkM ipVOjSVGTW8Fy75Q25yKw0iG7MrbHoVH91c8IRHNYG+QI4xnM0EDmyEAqLbg+qJWOi8W R7zA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n19si2193801pgk.158.2019.03.20.11.50.40; Wed, 20 Mar 2019 11:50:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727642AbfCTSuj (ORCPT + 31 others); Wed, 20 Mar 2019 14:50:39 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:44966 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727613AbfCTSuh (ORCPT ); Wed, 20 Mar 2019 14:50:37 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 404491BC0; Wed, 20 Mar 2019 11:50:37 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BAEC93F59C; Wed, 20 Mar 2019 11:50:35 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, coresight@lists.linaro.org, mike.leach@linaro.org, robert.walker@arm.com, Suzuki K Poulose , Mathieu Poirier Subject: [PATCH 16/25] coresight: stm: Rearrange probing the stimulus area Date: Wed, 20 Mar 2019 18:49:33 +0000 Message-Id: <1553107783-3340-17-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> References: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As we are about to refactor the platform specific handling re-arrange some of the DT specific property handling. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-stm.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c index 6afe033..eb96bba 100644 --- a/drivers/hwtracing/coresight/coresight-stm.c +++ b/drivers/hwtracing/coresight/coresight-stm.c @@ -684,14 +684,15 @@ static const struct attribute_group *coresight_stm_groups[] = { NULL, }; -static int stm_get_resource_byname(struct device_node *np, - char *ch_base, struct resource *res) +#ifdef CONFIG_OF +static int of_stm_get_stimulus_area(struct device *dev, struct resource *res) { const char *name = NULL; int index = 0, found = 0; + struct device_node *np = dev->of_node; while (!of_property_read_string_index(np, "reg-names", index, &name)) { - if (strcmp(ch_base, name)) { + if (strcmp("stm-stimulus-base", name)) { index++; continue; } @@ -706,6 +707,20 @@ static int stm_get_resource_byname(struct device_node *np, return of_address_to_resource(np, index, res); } +#else +static inline int of_stm_get_stimulus_area(struct device *dev, + struct resource *res) +{ + return -ENOENT; +} +#endif + +static int stm_get_stimulus_area(struct device *dev, struct resource *res) +{ + if (dev->of_node) + return of_stm_get_stimulus_area(dev, res); + return -ENOENT; +} static u32 stm_fundamental_data_size(struct stm_drvdata *drvdata) { @@ -819,7 +834,7 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id) return PTR_ERR(base); drvdata->base = base; - ret = stm_get_resource_byname(np, "stm-stimulus-base", &ch_res); + ret = stm_get_stimulus_area(dev, &ch_res); if (ret) return ret; drvdata->chs.phys = ch_res.start; From patchwork Wed Mar 20 18:49:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 160719 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp626634jan; Wed, 20 Mar 2019 11:51:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqy0hJHNz170Lf2ixU1ue2IbyPYLP7FCbpGdTRED4O1oQdmbjXDbnlctZwXMCe7nJaVeGIUv X-Received: by 2002:a63:d5f:: with SMTP id 31mr8765661pgn.274.1553107892965; Wed, 20 Mar 2019 11:51:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553107892; cv=none; d=google.com; s=arc-20160816; b=wgY7ngeP085vb7VaUp4gvCdPAfR95S5PazdO7KRVT/1oersHK1L7GOUuvG2ivINp01 3nqyI8jLHRKBxHh4Lk4JqNSYBF+oYnL8AWUI7AqV2MMGS3FSZoQ1zs9xVuUMu7uYzeZE oeTUg1vZC6hWujWV4sK39YNP5x9kFrf+Kq6RErvmVZmqedP8fHcdDh7jqk8qDt6q+6MR YIAIBGcGvlZYA0Jp9uukfLb45vZ+LS1Bs7ZISHzxRbkfHffOcdtwwqy6X3qJG1bi3qw3 vsKJ53iW5CwNSA6Uf2P+wpFRQnLZjpOpqZvnaz9OGYfQ5rjAMNrPVcIcZL+PZ5lI9aBT SP1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=shPP2bRXZP7qc6cHj18+430j0gDjnu+KdqwzoyLpcio=; b=jrpuwY5RrfLbH2JLXt6b2irbgLrfJ9LfFKVoKtg++V3Q06ZCGittL37cImFlkTj0Vj Sh0a2n7r7kHydfU819ctd0D0G8of/+TfzDzczdU6T+o6FLPvoAi5t2JSCSrFDiaUa8ry k680PAWvbMALK3fQqieIcD16CQ9eIGYc2loefQpaT1m8tOdu6tDOHf+CCFYe+Tov21Zo B49UUdPfLiMCbHNUEZ3TNWuZGh6YBGvMM/0OrIYBhV9VmifTZDHLUqdzEUvG07noL2Z5 cjpnRVDZ7z3hWjG0PE/teLMmbJv58rw0pd1ep9eVnR3OXNTPo+oVWHJqddDyc8iMm5fp 5IaQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d125si2310397pfd.206.2019.03.20.11.51.32; Wed, 20 Mar 2019 11:51:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727780AbfCTSvb (ORCPT + 31 others); Wed, 20 Mar 2019 14:51:31 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:44978 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727626AbfCTSuj (ORCPT ); Wed, 20 Mar 2019 14:50:39 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 026AE168F; Wed, 20 Mar 2019 11:50:39 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 7D0EE3F59C; Wed, 20 Mar 2019 11:50:37 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, coresight@lists.linaro.org, mike.leach@linaro.org, robert.walker@arm.com, Suzuki K Poulose , Mathieu Poirier Subject: [PATCH 17/25] coresight: tmc-etr: Rearrange probing default buffer size Date: Wed, 20 Mar 2019 18:49:34 +0000 Message-Id: <1553107783-3340-18-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> References: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As we are about to refactor the platform specific handling, make the default buffer size probing generic. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-tmc.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c index 9e7ff83..7ce3427 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.c +++ b/drivers/hwtracing/coresight/coresight-tmc.c @@ -375,6 +375,15 @@ static int tmc_etr_setup_caps(struct device *parent, u32 devid, void *dev_caps) return rc; } +static u32 tmc_etr_get_default_buffer_size(struct device *dev) +{ + u32 size; + + if (fwnode_property_read_u32(dev->fwnode, "arm,buffer-size", &size)) + size = SZ_1M; + return size; +} + static int tmc_probe(struct amba_device *adev, const struct amba_id *id) { int ret = 0; @@ -418,16 +427,10 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) drvdata->config_type = BMVAL(devid, 6, 7); drvdata->memwidth = tmc_get_memwidth(devid); - if (drvdata->config_type == TMC_CONFIG_TYPE_ETR) { - if (np) - ret = of_property_read_u32(np, - "arm,buffer-size", - &drvdata->size); - if (ret) - drvdata->size = SZ_1M; - } else { + if (drvdata->config_type == TMC_CONFIG_TYPE_ETR) + drvdata->size = tmc_etr_get_default_buffer_size(dev); + else drvdata->size = readl_relaxed(drvdata->base + TMC_RSZ) * 4; - } pm_runtime_put(&adev->dev); From patchwork Wed Mar 20 18:49:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 160710 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp625950jan; Wed, 20 Mar 2019 11:50:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqyaGZhowJ0O/CceA/2sacf0yY9tAbEgOi1BI58B3LWxZe5GXS/yDvkMTydQAtTfl/sFiYnJ X-Received: by 2002:a63:5415:: with SMTP id i21mr8804483pgb.106.1553107845019; Wed, 20 Mar 2019 11:50:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553107845; cv=none; d=google.com; s=arc-20160816; b=VGjo+b+eDcX7YKrODhFIu1GRgQsjjwHX5tjASA/LSj992UQB8aAOcHuYj2ieRzVSzz foAUCokfr8JlP0qcnc+7WA10f+nstPydVSKyDyELA4/4ux4FvyQchxomYpEwpF3BbsvD FnQ1vRN0oYV16WGUbRYydfr8aKYVcHXv+ZOvdZcwNSYEEhs+f4SIPiMx1wWu4QeH254V jhII9Zkh6UPrR1AyIsdKQumzotpythefzXgniL7KUFEJgrZpdpPChrCj9+qBLyAbwQq2 BunFh0kByTDd8hfshqeBGOIi6Ft3pjI0fi0wTOkejSLzwVbRf2bgMSf6yyRLlgWcsGS/ jISg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=M+Oux7Im8O/0dOu20IlpQL+UOnQRw0kU+gJF0PlX+9M=; b=sBaba2n+Km17B8KYoeJ+eNNcJu1/o76oy10PhUz1MhbeHEYCVwi+ff7KZTP77eD+ZD VtvyyfePaYpmOl3kr1NCOjN2j1WCLcnq11/HPOZ8RTDYEuxtQGn7w4GDiP6v0fzB1kcg pYyoFuob/ApOOSS5ExKes5Ww+y/RY8d8Lbr1P2kOA58mnd6rvd+NJNbWiwwz6Jha4CnU j+3Q0rRgxMemXLdmEYMwJCfaYzVQLLkME6emvYdiD4Si+5yQ1uh6CaSo8Qc8os85zUxv 5S47mz5OqkAWj7gPV2+b/suerqyqOwMpb7GTG7ifEuuyZKMLOzGcbmqrHmIm1kyrPVK1 l5HA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v5si2404227plp.392.2019.03.20.11.50.44; Wed, 20 Mar 2019 11:50:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727658AbfCTSun (ORCPT + 31 others); Wed, 20 Mar 2019 14:50:43 -0400 Received: from foss.arm.com ([217.140.101.70]:44984 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727613AbfCTSul (ORCPT ); Wed, 20 Mar 2019 14:50:41 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B8EDC1BF7; Wed, 20 Mar 2019 11:50:40 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 3F36C3F59C; Wed, 20 Mar 2019 11:50:39 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, coresight@lists.linaro.org, mike.leach@linaro.org, robert.walker@arm.com, Suzuki K Poulose , Mathieu Poirier Subject: [PATCH 18/25] coresight: Introduce generic platform data helper Date: Wed, 20 Mar 2019 18:49:35 +0000 Message-Id: <1553107783-3340-19-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> References: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org So far we have hard coded the DT platform parsing code in every driver. Introduce generic helper to parse the information provided by the firmware in a platform agnostic manner, in preparation for the ACPI support. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-catu.c | 13 ++--- drivers/hwtracing/coresight/coresight-etb10.c | 11 ++-- drivers/hwtracing/coresight/coresight-etm3x.c | 12 ++-- drivers/hwtracing/coresight/coresight-etm4x.c | 11 ++-- drivers/hwtracing/coresight/coresight-funnel.c | 11 ++-- drivers/hwtracing/coresight/coresight-platform.c | 65 +++++++++++++--------- drivers/hwtracing/coresight/coresight-replicator.c | 12 ++-- drivers/hwtracing/coresight/coresight-stm.c | 11 ++-- drivers/hwtracing/coresight/coresight-tmc.c | 13 ++--- drivers/hwtracing/coresight/coresight-tpiu.c | 11 ++-- include/linux/coresight.h | 7 +-- 11 files changed, 80 insertions(+), 97 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtracing/coresight/coresight-catu.c index 671a05a..4595c67 100644 --- a/drivers/hwtracing/coresight/coresight-catu.c +++ b/drivers/hwtracing/coresight/coresight-catu.c @@ -503,17 +503,14 @@ static int catu_probe(struct amba_device *adev, const struct amba_id *id) struct coresight_desc catu_desc; struct coresight_platform_data *pdata = NULL; struct device *dev = &adev->dev; - struct device_node *np = dev->of_node; void __iomem *base; - if (np) { - pdata = of_get_coresight_platform_data(dev, np); - if (IS_ERR(pdata)) { - ret = PTR_ERR(pdata); - goto out; - } - dev->platform_data = pdata; + pdata = coresight_get_platform_data(dev); + if (IS_ERR(pdata)) { + ret = PTR_ERR(pdata); + goto out; } + dev->platform_data = pdata; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) { diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index a471cbd..e4175849 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -688,14 +688,11 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id) struct etb_drvdata *drvdata; struct resource *res = &adev->res; struct coresight_desc desc = { 0 }; - struct device_node *np = adev->dev.of_node; - if (np) { - pdata = of_get_coresight_platform_data(dev, np); - if (IS_ERR(pdata)) - return PTR_ERR(pdata); - adev->dev.platform_data = pdata; - } + pdata = coresight_get_platform_data(dev); + if (IS_ERR(pdata)) + return PTR_ERR(pdata); + adev->dev.platform_data = pdata; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c index 7137f06..b101464 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x.c +++ b/drivers/hwtracing/coresight/coresight-etm3x.c @@ -788,20 +788,16 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id) struct etm_drvdata *drvdata; struct resource *res = &adev->res; struct coresight_desc desc = { 0 }; - struct device_node *np = adev->dev.of_node; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) return -ENOMEM; - if (np) { - pdata = of_get_coresight_platform_data(dev, np); - if (IS_ERR(pdata)) - return PTR_ERR(pdata); - - adev->dev.platform_data = pdata; - } + pdata = coresight_get_platform_data(dev); + if (IS_ERR(pdata)) + return PTR_ERR(pdata); + adev->dev.platform_data = pdata; drvdata->use_cp14 = fwnode_property_read_bool(dev->fwnode, "arm,cp14"); dev_set_drvdata(dev, drvdata); diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index 8d5ee3b..bfc23ab 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -974,18 +974,15 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) struct etmv4_drvdata *drvdata; struct resource *res = &adev->res; struct coresight_desc desc = { 0 }; - struct device_node *np = adev->dev.of_node; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) return -ENOMEM; - if (np) { - pdata = of_get_coresight_platform_data(dev, np); - if (IS_ERR(pdata)) - return PTR_ERR(pdata); - adev->dev.platform_data = pdata; - } + pdata = coresight_get_platform_data(dev); + if (IS_ERR(pdata)) + return PTR_ERR(pdata); + adev->dev.platform_data = pdata; dev_set_drvdata(dev, drvdata); diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c index 1085f31..2590744 100644 --- a/drivers/hwtracing/coresight/coresight-funnel.c +++ b/drivers/hwtracing/coresight/coresight-funnel.c @@ -185,14 +185,11 @@ static int funnel_probe(struct amba_device *adev, const struct amba_id *id) struct funnel_drvdata *drvdata; struct resource *res = &adev->res; struct coresight_desc desc = { 0 }; - struct device_node *np = adev->dev.of_node; - if (np) { - pdata = of_get_coresight_platform_data(dev, np); - if (IS_ERR(pdata)) - return PTR_ERR(pdata); - adev->dev.platform_data = pdata; - } + pdata = coresight_get_platform_data(dev); + if (IS_ERR(pdata)) + return PTR_ERR(pdata); + adev->dev.platform_data = pdata; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c index 514cc2b..693e3f5 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -17,6 +17,20 @@ #include #include +static int coresight_alloc_conns(struct device *dev, + struct coresight_platform_data *pdata) +{ + if (pdata->nr_outport) { + pdata->conns = devm_kzalloc(dev, pdata->nr_outport * + sizeof(*pdata->conns), + GFP_KERNEL); + if (!pdata->conns) + return -ENOMEM; + } + + return 0; +} + #ifdef CONFIG_OF static int of_dev_node_match(struct device *dev, void *data) { @@ -133,20 +147,6 @@ static void of_coresight_get_ports(const struct device_node *node, } } -static int of_coresight_alloc_memory(struct device *dev, - struct coresight_platform_data *pdata) -{ - if (pdata->nr_outport) { - pdata->conns = devm_kzalloc(dev, pdata->nr_outport * - sizeof(*pdata->conns), - GFP_KERNEL); - if (!pdata->conns) - return -ENOMEM; - } - - return 0; -} - int of_coresight_get_cpu(const struct device_node *node) { int cpu; @@ -226,23 +226,17 @@ static int of_coresight_parse_endpoint(struct device *dev, return ret; } -struct coresight_platform_data * +static struct coresight_platform_data * of_get_coresight_platform_data(struct device *dev, - const struct device_node *node) + struct coresight_platform_data *pdata) { int ret = 0; - struct coresight_platform_data *pdata; struct coresight_connection *conn; struct device_node *ep = NULL; const struct device_node *parent = NULL; bool legacy_binding = false; + struct device_node *node = dev->of_node; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) - return ERR_PTR(-ENOMEM); - - /* Use device name as sysfs handle */ - pdata->name = dev_name(dev); pdata->cpu = of_coresight_get_cpu(node); /* Get the number of input and output port for this component */ @@ -252,7 +246,7 @@ of_get_coresight_platform_data(struct device *dev, if (!pdata->nr_outport) return pdata; - ret = of_coresight_alloc_memory(dev, pdata); + ret = coresight_alloc_conns(dev, pdata); if (ret) return ERR_PTR(ret); @@ -294,5 +288,26 @@ of_get_coresight_platform_data(struct device *dev, return pdata; } -EXPORT_SYMBOL_GPL(of_get_coresight_platform_data); #endif + +struct coresight_platform_data * +coresight_get_platform_data(struct device *dev) +{ + struct coresight_platform_data *pdata; + + if (IS_ERR_OR_NULL(dev->fwnode)) + return NULL; + + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return ERR_PTR(-ENOMEM); + + /* Use device name as sysfs handle */ + pdata->name = dev_name(dev); + + if (is_of_node(dev->fwnode)) + return of_get_coresight_platform_data(dev, pdata); + + return ERR_PTR(-ENOENT); +} +EXPORT_SYMBOL_GPL(coresight_get_platform_data); diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c index 8bbb008..7eb3bf7 100644 --- a/drivers/hwtracing/coresight/coresight-replicator.c +++ b/drivers/hwtracing/coresight/coresight-replicator.c @@ -177,15 +177,12 @@ static int replicator_probe(struct device *dev, struct resource *res) struct coresight_platform_data *pdata = NULL; struct replicator_drvdata *drvdata; struct coresight_desc desc = { 0 }; - struct device_node *np = dev->of_node; void __iomem *base; - if (np) { - pdata = of_get_coresight_platform_data(dev, np); - if (IS_ERR(pdata)) - return PTR_ERR(pdata); - dev->platform_data = pdata; - } + pdata = coresight_get_platform_data(dev); + if (IS_ERR(pdata)) + return PTR_ERR(pdata); + dev->platform_data = pdata; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) @@ -213,7 +210,6 @@ static int replicator_probe(struct device *dev, struct resource *res) } dev_set_drvdata(dev, drvdata); - desc.type = CORESIGHT_DEV_TYPE_LINK; desc.subtype.link_subtype = CORESIGHT_DEV_SUBTYPE_LINK_SPLIT; desc.ops = &replicator_cs_ops; diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c index eb96bba..6514586 100644 --- a/drivers/hwtracing/coresight/coresight-stm.c +++ b/drivers/hwtracing/coresight/coresight-stm.c @@ -809,14 +809,11 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id) size_t bitmap_size; struct coresight_desc desc = { 0 }; struct coresight_device *csdev; - struct device_node *np = adev->dev.of_node; - if (np) { - pdata = of_get_coresight_platform_data(dev, np); - if (IS_ERR(pdata)) - return PTR_ERR(pdata); - adev->dev.platform_data = pdata; - } + pdata = coresight_get_platform_data(dev); + if (IS_ERR(pdata)) + return PTR_ERR(pdata); + adev->dev.platform_data = pdata; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) return -ENOMEM; diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c index 7ce3427..147ab17 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.c +++ b/drivers/hwtracing/coresight/coresight-tmc.c @@ -394,16 +394,13 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) struct tmc_drvdata *drvdata; struct resource *res = &adev->res; struct coresight_desc desc = { 0 }; - struct device_node *np = adev->dev.of_node; - if (np) { - pdata = of_get_coresight_platform_data(dev, np); - if (IS_ERR(pdata)) { - ret = PTR_ERR(pdata); - goto out; - } - adev->dev.platform_data = pdata; + pdata = coresight_get_platform_data(dev); + if (IS_ERR(pdata)) { + ret = PTR_ERR(pdata); + goto out; } + adev->dev.platform_data = pdata; ret = -ENOMEM; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c index 9763721..18a749a 100644 --- a/drivers/hwtracing/coresight/coresight-tpiu.c +++ b/drivers/hwtracing/coresight/coresight-tpiu.c @@ -120,14 +120,11 @@ static int tpiu_probe(struct amba_device *adev, const struct amba_id *id) struct resource *res = &adev->res; struct coresight_desc desc = { 0 }; struct coresight_device *csdev; - struct device_node *np = adev->dev.of_node; - if (np) { - pdata = of_get_coresight_platform_data(dev, np); - if (IS_ERR(pdata)) - return PTR_ERR(pdata); - adev->dev.platform_data = pdata; - } + pdata = coresight_get_platform_data(dev); + if (IS_ERR(pdata)) + return PTR_ERR(pdata); + adev->dev.platform_data = pdata; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) diff --git a/include/linux/coresight.h b/include/linux/coresight.h index 7b87965..5b29255 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -293,14 +293,11 @@ static inline void coresight_disclaim_device_unlocked(void __iomem *base) {} #ifdef CONFIG_OF extern int of_coresight_get_cpu(const struct device_node *node); -extern struct coresight_platform_data * -of_get_coresight_platform_data(struct device *dev, - const struct device_node *node); #else static inline int of_coresight_get_cpu(const struct device_node *node) { return 0; } -static inline struct coresight_platform_data *of_get_coresight_platform_data( - struct device *dev, const struct device_node *node) { return NULL; } #endif +struct coresight_platform_data *coresight_get_platform_data(struct device *dev); + #endif From patchwork Wed Mar 20 18:49:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 160711 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp625967jan; Wed, 20 Mar 2019 11:50:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqznC+9VJLHpSjTsdapSMN4ST6V/9/kr2vTIxSFTIUHNtGpCWHahRlclIVHwrKxfi80K6W8d X-Received: by 2002:aa7:8b12:: with SMTP id f18mr9836401pfd.240.1553107845966; Wed, 20 Mar 2019 11:50:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553107845; cv=none; d=google.com; s=arc-20160816; b=mHMgUj4HdJ77Xn5ZOLQJ8OzSxGn6Kf9B+N5goIV6cafhnOSKV0DfSv7dLUaBpye2Ou OI6U0UoyPbVlzLXSKw7QUlvdhi7tWizwAnwMTR2FIABIWjriqgTpx49RjOPjTbukVsFH r0aa6GT3Gr+LnEljCQ3vJgfU9oHqZ2p92ujMyev6zMpXBj4fb11t+PXjMwHMTsWiNMJJ sikC5bj71TQmTlvEVNHC5YsCKrJZq1S3C5stjp0ssMRTz+XrHCiWq9ILWgRjW0evHb8m CXrl/sf6QHdGoGOYLfkBMBPyLjKvuwg3Vufr0DrPmRrYF8CD80ouAw6IbUmGZPH0V/5h LLig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=a1MSRGsF/BUKCKmdg1a13s3AMsYDdtAX127E4lCY4GE=; b=fy1p4Ag6f9o+3VqZp9sovjBeqTntqCjb+7sh7DB7+zdC5FwXBY8YneckkIIIcQEvJy 4nLJxjSxmuOdbyzb7sUC1mKd3UCL7GxzpWf8lDWzDrJbpiIk3GbOHnWCLTl52IfRScsR ppgJSU8gmYFLX3b0Yl9rmhAQR1MaetbMENsjLTlS7r78eeOjNWdtVSpsTEU/8gggl+zg H5OFjVwpq1HtSBevJKDDa9LthPazOp4qAfhVciYfP8L3WB1psYOcQiMd7V5sIDU5+Aff pTyGOaR2VxXF1EJueyHU4yz3Jsutib8DiUVNApWEqcvS9QjMIMNbzRJgl5tXgkNIfev4 UvhA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d37si2570743pla.71.2019.03.20.11.50.45; Wed, 20 Mar 2019 11:50:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727670AbfCTSuo (ORCPT + 31 others); Wed, 20 Mar 2019 14:50:44 -0400 Received: from foss.arm.com ([217.140.101.70]:44998 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727062AbfCTSum (ORCPT ); Wed, 20 Mar 2019 14:50:42 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7CB631C00; Wed, 20 Mar 2019 11:50:42 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 035993F59C; Wed, 20 Mar 2019 11:50:40 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, coresight@lists.linaro.org, mike.leach@linaro.org, robert.walker@arm.com, Suzuki K Poulose , Mathieu Poirier Subject: [PATCH 19/25] coresight: Make device to CPU mapping generic Date: Wed, 20 Mar 2019 18:49:36 +0000 Message-Id: <1553107783-3340-20-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> References: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The CoreSight components ETM and CPU-Debug are always associated with CPUs. Replace the of_coresight_get_cpu() with a platform agnostic helper, in preparation to add ACPI support. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-cpu-debug.c | 3 +-- drivers/hwtracing/coresight/coresight-platform.c | 18 +++++++++++++----- include/linux/coresight.h | 7 +------ 3 files changed, 15 insertions(+), 13 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-cpu-debug.c b/drivers/hwtracing/coresight/coresight-cpu-debug.c index e8819d7..07a1367 100644 --- a/drivers/hwtracing/coresight/coresight-cpu-debug.c +++ b/drivers/hwtracing/coresight/coresight-cpu-debug.c @@ -572,14 +572,13 @@ static int debug_probe(struct amba_device *adev, const struct amba_id *id) struct device *dev = &adev->dev; struct debug_drvdata *drvdata; struct resource *res = &adev->res; - struct device_node *np = adev->dev.of_node; int ret; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) return -ENOMEM; - drvdata->cpu = np ? of_coresight_get_cpu(np) : 0; + drvdata->cpu = coresight_get_cpu(dev); if (per_cpu(debug_drvdata, drvdata->cpu)) { dev_err(dev, "CPU%d drvdata has already been initialized\n", drvdata->cpu); diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c index 693e3f5..93b6c87 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -147,12 +147,14 @@ static void of_coresight_get_ports(const struct device_node *node, } } -int of_coresight_get_cpu(const struct device_node *node) +static int of_coresight_get_cpu(struct device *dev) { int cpu; struct device_node *dn; - dn = of_parse_phandle(node, "cpu", 0); + if (!dev->of_node) + return 0; + dn = of_parse_phandle(dev->of_node, "cpu", 0); /* Affinity defaults to CPU0 */ if (!dn) return 0; @@ -162,7 +164,6 @@ int of_coresight_get_cpu(const struct device_node *node) /* Affinity to CPU0 if no cpu nodes are found */ return (cpu < 0) ? 0 : cpu; } -EXPORT_SYMBOL_GPL(of_coresight_get_cpu); /* * of_coresight_parse_endpoint : Parse the given output endpoint @ep @@ -237,8 +238,6 @@ of_get_coresight_platform_data(struct device *dev, bool legacy_binding = false; struct device_node *node = dev->of_node; - pdata->cpu = of_coresight_get_cpu(node); - /* Get the number of input and output port for this component */ of_coresight_get_ports(node, &pdata->nr_inport, &pdata->nr_outport); @@ -290,6 +289,14 @@ of_get_coresight_platform_data(struct device *dev, } #endif +int coresight_get_cpu(struct device *dev) +{ + if (is_of_node(dev->fwnode)) + return of_coresight_get_cpu(dev); + return 0; +} +EXPORT_SYMBOL_GPL(coresight_get_cpu); + struct coresight_platform_data * coresight_get_platform_data(struct device *dev) { @@ -304,6 +311,7 @@ coresight_get_platform_data(struct device *dev) /* Use device name as sysfs handle */ pdata->name = dev_name(dev); + pdata->cpu = coresight_get_cpu(dev); if (is_of_node(dev->fwnode)) return of_get_coresight_platform_data(dev, pdata); diff --git a/include/linux/coresight.h b/include/linux/coresight.h index 5b29255..a48cd9b 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -291,12 +291,7 @@ static inline void coresight_disclaim_device_unlocked(void __iomem *base) {} #endif -#ifdef CONFIG_OF -extern int of_coresight_get_cpu(const struct device_node *node); -#else -static inline int of_coresight_get_cpu(const struct device_node *node) -{ return 0; } -#endif +extern int coresight_get_cpu(struct device *dev); struct coresight_platform_data *coresight_get_platform_data(struct device *dev); From patchwork Wed Mar 20 18:49:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 160717 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp626381jan; Wed, 20 Mar 2019 11:51:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxdIOO621QvBXZ94qIHqjQ63TjFC5q8l/c9TEEevaSby0dhoXR7/JyC9HQaFUtI7ZIXxng+ X-Received: by 2002:a17:902:a98c:: with SMTP id bh12mr9321798plb.289.1553107875541; Wed, 20 Mar 2019 11:51:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553107875; cv=none; d=google.com; s=arc-20160816; b=GApY2GvFbWnr0GfVuPRZyoEwCd+ju4HYLoxJ0Ts6SqDTwuAYY4Stj3XQtWp4INIkn3 GXGU0MfdCIMiYClcWSI2NnCK5IYsWgZUtlZ7c9zIB8NQE7Z0kCmFaZmI3vd58JNpTJo9 Q2EWJgRh7Y0B0InB4wPk9bAB+/Q0/oAzpIgIerzq/lqHPh7ZWvA26+03Z82tMZ1eA9l1 32it6Oc5G8e+oVFiaPZMLDuNnl313OHrqO2d+y3vM5HMo4ENIF5YAolQ9jsACaPk0Czm qULurzAxahXIuq0bkoZNu/qCdhdJCKYPNgkpDRMxNWcWjC9kvDmopKatrjGioUndgQ0X +0PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=wfXSHKYkvK5PSGcPN2UoguzGa/Yd9DUdR3d523m4nUg=; b=Iqqh9neJCZGjKigPnJzYwlxCock4qB4X++lqnMKSGh/MeGqN6DecHsLZ7ghcRRNIgE PRGHJDxw7R6pWD/s82vBbAhSCbr61UDH5MdltiwCPdJDNG9ww7EJB64R56NCmpLrOiRi 9BUv6zT7eXdX6hR3nCJEI+/sqjUwTkWtrfEJifW6IEOi3ieNEKynf6Etea+7bAp03+kx nLVV0D5gvkhwpdK2iC+mI26xcBP2VInNl4h5DX6HT8xmrEkVIrS+mm+haBJgbIoA0WJS 9FK+A79xnJodffMO/WtwW8hm2g0Pi+hY4F9QxHBv5KcMzSqvaUJdoTdl8+9MANCtpzX9 6Xzg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g143si2234534pfb.29.2019.03.20.11.51.14; Wed, 20 Mar 2019 11:51:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727683AbfCTSus (ORCPT + 31 others); Wed, 20 Mar 2019 14:50:48 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:45010 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727062AbfCTSuo (ORCPT ); Wed, 20 Mar 2019 14:50:44 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3ED081BC0; Wed, 20 Mar 2019 11:50:44 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B98463F59C; Wed, 20 Mar 2019 11:50:42 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, coresight@lists.linaro.org, mike.leach@linaro.org, robert.walker@arm.com, Suzuki K Poulose , Mathieu Poirier Subject: [PATCH 20/25] coresight: platform: Use fwnode handle for device search Date: Wed, 20 Mar 2019 18:49:37 +0000 Message-Id: <1553107783-3340-21-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> References: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We match of_node while searching for a device. Make this more generic in preparation for the ACPI support by using fwnode_handle. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-platform.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c index 93b6c87..877ed2b 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -31,14 +31,13 @@ static int coresight_alloc_conns(struct device *dev, return 0; } -#ifdef CONFIG_OF -static int of_dev_node_match(struct device *dev, void *data) +static int coresight_fwnode_handle_match(struct device *dev, void *data) { - return dev->of_node == data; + return dev_fwnode(dev) == data; } static struct device * -of_coresight_get_endpoint_device(struct device_node *endpoint) +coresight_find_device_by_fwnode(struct fwnode_handle *fwnode) { struct device *dev = NULL; @@ -47,7 +46,7 @@ of_coresight_get_endpoint_device(struct device_node *endpoint) * platform bus. */ dev = bus_find_device(&platform_bus_type, NULL, - endpoint, of_dev_node_match); + fwnode, coresight_fwnode_handle_match); if (dev) return dev; @@ -56,9 +55,10 @@ of_coresight_get_endpoint_device(struct device_node *endpoint) * looking for the device that matches the endpoint node. */ return bus_find_device(&amba_bustype, NULL, - endpoint, of_dev_node_match); + fwnode, coresight_fwnode_handle_match); } +#ifdef CONFIG_OF static inline bool of_coresight_legacy_ep_is_input(struct device_node *ep) { return of_property_read_bool(ep, "slave-mode"); @@ -186,6 +186,7 @@ static int of_coresight_parse_endpoint(struct device *dev, struct device_node *rparent = NULL; struct device_node *rep = NULL; struct device *rdev = NULL; + struct fwnode_handle *rdev_fwnode; do { /* Parse the local port details */ @@ -204,8 +205,9 @@ static int of_coresight_parse_endpoint(struct device *dev, if (of_graph_parse_endpoint(rep, &rendpoint)) break; + rdev_fwnode = of_fwnode_handle(rparent); /* If the remote device is not available, defer probing */ - rdev = of_coresight_get_endpoint_device(rparent); + rdev = coresight_find_device_by_fwnode(rdev_fwnode); if (!rdev) { ret = -EPROBE_DEFER; break; From patchwork Wed Mar 20 18:49:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 160712 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp626011jan; Wed, 20 Mar 2019 11:50:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqy+rXw9LQeZ2i6tuW4FnbpOHpl8f/HFDVMAP1tFVH3cZGKsUb4YYCki0+6ImXXYip0ghHdf X-Received: by 2002:a17:902:1002:: with SMTP id b2mr9262179pla.248.1553107849969; Wed, 20 Mar 2019 11:50:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553107849; cv=none; d=google.com; s=arc-20160816; b=vJggHytr0Qlm0f7mmpKgdJeTKjQoab9ykXxHNL3E5vohLKKYwOyb0WJ8JLdbBqB2qS D5tXsNFWqTEtt75Ko50+rrQh98ZdQpzP05OqChXFNCNm4a8gI1FzsVLWXG9vT51OdE1y oUQaTsaPKCoaTgFvOQxLR5Uw+uLGC2A2c8GPEmbDU7/Bmg2O4l3wIbissCAfG5bX1bO6 //QEkjXk/7UPHk3bNXG0Fm0dMJI37pM1WtlGmw0ck8hLdJ+q8r+w8NlZNg8+k1T7V7Dp urQ2RfbhfqG+Fz8SRwgNQBd+W0R9GT/+2ZnmXdPK9a2gEt9wb9HYBjkF4FuI9j2RVe3R yPtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=ztQRM2PsxQXTFtmdaXhPRmMKwTLw6DyN3kSrWhVZoAw=; b=GROlvOl7HsobbVJtImuAf4ODtS9BVYfzce/TMWVcWHv9a1VH+TULeuyTApODwX3e3J ypvTf9nU8qHlYEhte+YycvUsDQmCrdVl4VELX0hDUy9v/p1IL0oIRm+/itYszjO/AKrf CdcT99WOf6NBISaBtJiL9qvICwk11VZLWiD+AkYNg7XE1LEyepqdpwk04qOwve1VrHth WZJngdYkzYmxLgR1JHvobdhtLFQDlbB1PBfKzx/f26DCRjioTNywPD16xTZ40/KZUUxO oO3cjObvFrHqwjeXrk0Ucg879k2StrTGyr0cUdvvoKjqTSQw7tL3aL2Mh0Aoi9PeaxXW 3drQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d37si2570743pla.71.2019.03.20.11.50.49; Wed, 20 Mar 2019 11:50:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727695AbfCTSut (ORCPT + 31 others); Wed, 20 Mar 2019 14:50:49 -0400 Received: from foss.arm.com ([217.140.101.70]:45018 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727227AbfCTSuq (ORCPT ); Wed, 20 Mar 2019 14:50:46 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0124F1BF7; Wed, 20 Mar 2019 11:50:46 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 7B9853F59C; Wed, 20 Mar 2019 11:50:44 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, coresight@lists.linaro.org, mike.leach@linaro.org, robert.walker@arm.com, Suzuki K Poulose , Mathieu Poirier Subject: [PATCH 21/25] coresight: Use fwnode handle instead of device names Date: Wed, 20 Mar 2019 18:49:38 +0000 Message-Id: <1553107783-3340-22-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> References: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We rely on the device names to find a CoreSight device on the coresight bus. The device name however is obtained from the platform, which is bound to the real platform/amba device. As we are about to use different naming scheme for the coresight devices, we can't rely on the platform device name to find the corresponding coresight device. Instead we use the platform agnostic "fwnode handle" of the parent device to find the devices. We also reuse the same fwnode as the parent for the Coresight device we create. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-platform.c | 10 ++++------ drivers/hwtracing/coresight/coresight-priv.h | 2 ++ drivers/hwtracing/coresight/coresight.c | 19 +++++++++++-------- include/linux/coresight.h | 4 ++-- 4 files changed, 19 insertions(+), 16 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c index 877ed2b..5eee987 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -31,7 +31,7 @@ static int coresight_alloc_conns(struct device *dev, return 0; } -static int coresight_fwnode_handle_match(struct device *dev, void *data) +int coresight_match_fwnode_handle(struct device *dev, void *data) { return dev_fwnode(dev) == data; } @@ -46,7 +46,7 @@ coresight_find_device_by_fwnode(struct fwnode_handle *fwnode) * platform bus. */ dev = bus_find_device(&platform_bus_type, NULL, - fwnode, coresight_fwnode_handle_match); + fwnode, coresight_match_fwnode_handle); if (dev) return dev; @@ -55,7 +55,7 @@ coresight_find_device_by_fwnode(struct fwnode_handle *fwnode) * looking for the device that matches the endpoint node. */ return bus_find_device(&amba_bustype, NULL, - fwnode, coresight_fwnode_handle_match); + fwnode, coresight_match_fwnode_handle); } #ifdef CONFIG_OF @@ -214,9 +214,7 @@ static int of_coresight_parse_endpoint(struct device *dev, } conn->outport = endpoint.port; - conn->child_name = devm_kstrdup(dev, - dev_name(rdev), - GFP_KERNEL); + conn->child_fwnode = fwnode_handle_get(rdev_fwnode); conn->child_port = rendpoint.port; /* Connection record updated */ ret = 1; diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h index e0684d0..8fb1243 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -153,6 +153,8 @@ struct list_head *coresight_build_path(struct coresight_device *csdev, struct coresight_device *sink); void coresight_release_path(struct list_head *path); +int coresight_match_fwnode_handle(struct device *dev, void *data); + #ifdef CONFIG_CORESIGHT_SOURCE_ETM3X extern int etm_readl_cp14(u32 off, unsigned int *val); extern int etm_writel_cp14(u32 off, u32 val); diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 29cef89..9cdedab 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -1005,13 +1005,11 @@ static int coresight_orphan_match(struct device *dev, void *data) /* We have found at least one orphan connection */ if (conn->child_dev == NULL) { /* Does it match this newly added device? */ - if (conn->child_name && - !strcmp(dev_name(&csdev->dev), conn->child_name)) { + if (conn->child_fwnode == csdev->dev.fwnode) conn->child_dev = csdev; - } else { + else /* This component still has an orphan */ still_orphan = true; - } } } @@ -1043,9 +1041,9 @@ static void coresight_fixup_device_conns(struct coresight_device *csdev) struct coresight_connection *conn = &csdev->conns[i]; struct device *dev = NULL; - if (conn->child_name) - dev = bus_find_device_by_name(&coresight_bustype, NULL, - conn->child_name); + dev = bus_find_device(&coresight_bustype, NULL, + (void *)conn->child_fwnode, + coresight_match_fwnode_handle); if (dev) { conn->child_dev = to_coresight_device(dev); /* and put reference from 'bus_find_device()' */ @@ -1080,9 +1078,11 @@ static int coresight_remove_match(struct device *dev, void *data) if (conn->child_dev == NULL) continue; - if (!strcmp(dev_name(&csdev->dev), conn->child_name)) { + if (csdev->dev.fwnode == conn->child_fwnode) { iterator->orphan = true; conn->child_dev = NULL; + /* Drop the reference to the handle for connection */ + fwnode_handle_put(conn->child_fwnode); /* No need to continue */ break; } @@ -1198,6 +1198,8 @@ struct coresight_device *coresight_register(struct coresight_desc *desc) csdev->dev.parent = desc->dev; csdev->dev.release = coresight_device_release; csdev->dev.bus = &coresight_bustype; + csdev->dev.fwnode = fwnode_handle_get(dev_fwnode(desc->dev)); + dev_set_name(&csdev->dev, "%s", desc->pdata->name); ret = device_register(&csdev->dev); @@ -1247,6 +1249,7 @@ void coresight_unregister(struct coresight_device *csdev) etm_perf_del_symlink_sink(csdev); /* Remove references of that device in the topology */ coresight_remove_conns(csdev); + fwnode_handle_put(csdev->dev.fwnode); device_unregister(&csdev->dev); } EXPORT_SYMBOL_GPL(coresight_unregister); diff --git a/include/linux/coresight.h b/include/linux/coresight.h index a48cd9b..76c31b2 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -128,14 +128,14 @@ struct coresight_desc { /** * struct coresight_connection - representation of a single connection * @outport: a connection's output port number. - * @chid_name: remote component's name. + * @chid_fwnode: remote component's fwnode handle. * @child_port: remote component's port number @output is connected to. * @child_dev: a @coresight_device representation of the component connected to @outport. */ struct coresight_connection { int outport; - const char *child_name; + struct fwnode_handle *child_fwnode; int child_port; struct coresight_device *child_dev; }; From patchwork Wed Mar 20 18:49:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 160718 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp626424jan; Wed, 20 Mar 2019 11:51:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqySuUZ2phHwAOInxl7DLc99QH6BsJk2csEJ41H55atspitF4cuhLrbDdux/MIvZVBYb7hFS X-Received: by 2002:a62:5543:: with SMTP id j64mr31767114pfb.105.1553107878680; Wed, 20 Mar 2019 11:51:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553107878; cv=none; d=google.com; s=arc-20160816; b=I+q0D+T9APs2GL9AdTLckL2dSbG43MvFKAt5zywwcymCnp22PJczpxk4/Sf0eFwSQc VrRfmOWHsxTt7qOQ9lbL9rDAdL/Ov8C26YfhsGwv+LlK5ml8aAEipkhwGut53np5ClKI CjJtgJX7MNtyAmknLhYsUEFJRXjSEaqVyFx8YzPDwAq8jCNEPF0+zt/AFKov08mkQKuk M9/5DzNoTPmhG6mWv1l0gEKVPXcKV9GUveC7kXckoDkw/jAn4cljnfMNRlx31WcroYTr YOEdqrPw/3NV+LDhJ8yjRNjhUIvh+WY72yd/w1hs0WXFmbsiYjyCdUbYqxQte1VvqMR4 0Nmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=XJPy+B19CQsRKctuZjMnoPAxnWCeLNnQzKl17+lYGsU=; b=nUoh3yctPMXHtvywakuswhvz95ltvQkK98tGtU2jVscpAsCZAcTEy5PSAaTkn64Flp KZg7esllgREwqRXiPHAGTCSyY7kOG8iNwD3Q3e6CI9lR+opVjKMjHBWnQs7/X41R5RU/ xdLA/WRyi2EpfCM27J1xUkO+irMx+s4rHrJG2mq2vE1VCCVeHNW1kC6zvvKxCB4KloWw n6PY+B6QynAAkCcZ8tMsJrg6fP11Cjfyx4lmgi4UyJivjQCKqTB368dlnYT21jgiSaB2 wggK2xSeAv4xa/xHbr3XpP8k7KfBjSzCMIe2aZ5uW1vuIp4WqgCXKcgX3OMUsIc6vVkq N3Zw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g143si2234534pfb.29.2019.03.20.11.51.18; Wed, 20 Mar 2019 11:51:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727768AbfCTSvR (ORCPT + 31 others); Wed, 20 Mar 2019 14:51:17 -0400 Received: from foss.arm.com ([217.140.101.70]:45038 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727678AbfCTSus (ORCPT ); Wed, 20 Mar 2019 14:50:48 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B73001BC0; Wed, 20 Mar 2019 11:50:47 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 3DD123F59C; Wed, 20 Mar 2019 11:50:46 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, coresight@lists.linaro.org, mike.leach@linaro.org, robert.walker@arm.com, Suzuki K Poulose , Mathieu Poirier Subject: [PATCH 22/25] coresight: Use platform agnostic names Date: Wed, 20 Mar 2019 18:49:39 +0000 Message-Id: <1553107783-3340-23-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> References: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org So far we have reused the name of the "platform" device for the CoreSight device. But this is not very intuitive when we move to ACPI. Also, the ACPI device names have ":" in them (e.g, ARMHC97C:01), which the perf tool doesn't like very much. This patch introduces a generic naming scheme, givin more intuitive names for the devices that appear on the CoreSight bus. The names follow the pattern "prefix" followed by "index" (e.g, etm5). We maintain a list of allocated devices per "prefix" to make sure we don't allocate a new name when it is reprobed (e.g, due to unsatisifed device dependencies). So, we maintain the list of "fwnodes" of the parent devices to allocate a consistent name. All devices except the ETMs get an index allocated in the order of probing. ETMs get an index based on the CPU they are attached to. TMC devices are named using "tmc_etf", "tmc_etb", and "tmc_etr" prefixes depending on the configuration of the device. The replicators are not classified as dynamic/static anymore. One could easily figure that out by checking the presence of "mgmt" registers under sysfs. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-catu.c | 7 +++ drivers/hwtracing/coresight/coresight-etb10.c | 6 +++ drivers/hwtracing/coresight/coresight-etm3x.c | 5 ++ drivers/hwtracing/coresight/coresight-etm4x.c | 4 ++ drivers/hwtracing/coresight/coresight-funnel.c | 6 +++ drivers/hwtracing/coresight/coresight-replicator.c | 7 +++ drivers/hwtracing/coresight/coresight-stm.c | 6 +++ drivers/hwtracing/coresight/coresight-tmc.c | 14 ++++++ drivers/hwtracing/coresight/coresight-tpiu.c | 6 +++ drivers/hwtracing/coresight/coresight.c | 58 ++++++++++++++++++++++ include/linux/coresight.h | 25 +++++++++- 11 files changed, 143 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtracing/coresight/coresight-catu.c index 4595c67..6492bce 100644 --- a/drivers/hwtracing/coresight/coresight-catu.c +++ b/drivers/hwtracing/coresight/coresight-catu.c @@ -28,6 +28,8 @@ #define catu_dbg(x, ...) do {} while (0) #endif +DEFINE_CORESIGHT_DEVLIST(catu_devs, "catu"); + struct catu_etr_buf { struct tmc_sg_table *catu_table; dma_addr_t sladdr; @@ -510,6 +512,11 @@ static int catu_probe(struct amba_device *adev, const struct amba_id *id) ret = PTR_ERR(pdata); goto out; } + + pdata->name = coresight_alloc_device_name(&catu_devs, dev); + if (!pdata->name) + return -ENOMEM; + dev->platform_data = pdata; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index e4175849..42b525c 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -62,6 +62,8 @@ #define ETB_FFSR_BIT 1 #define ETB_FRAME_SIZE_WORDS 4 +DEFINE_CORESIGHT_DEVLIST(etb10_devs, "etb10_"); + /** * struct etb_drvdata - specifics associated to an ETB component * @base: memory mapped base address for this component. @@ -692,6 +694,10 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id) pdata = coresight_get_platform_data(dev); if (IS_ERR(pdata)) return PTR_ERR(pdata); + pdata->name = coresight_alloc_device_name(&etb10_devs, dev); + if (!pdata->name) + return -ENOMEM; + adev->dev.platform_data = pdata; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c index b101464..35ed953 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x.c +++ b/drivers/hwtracing/coresight/coresight-etm3x.c @@ -797,6 +797,11 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id) if (IS_ERR(pdata)) return PTR_ERR(pdata); + pdata->name = devm_kasprintf(dev, GFP_KERNEL, + "etm%d", pdata->cpu); + if (!pdata->name) + return -ENOMEM; + adev->dev.platform_data = pdata; drvdata->use_cp14 = fwnode_property_read_bool(dev->fwnode, "arm,cp14"); dev_set_drvdata(dev, drvdata); diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index bfc23ab..55fcb78 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -982,6 +982,10 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) pdata = coresight_get_platform_data(dev); if (IS_ERR(pdata)) return PTR_ERR(pdata); + pdata->name = devm_kasprintf(dev, GFP_KERNEL, "etm%d", pdata->cpu); + if (!pdata->name) + return -ENOMEM; + adev->dev.platform_data = pdata; dev_set_drvdata(dev, drvdata); diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c index 2590744..96b6773 100644 --- a/drivers/hwtracing/coresight/coresight-funnel.c +++ b/drivers/hwtracing/coresight/coresight-funnel.c @@ -27,6 +27,8 @@ #define FUNNEL_HOLDTIME (0x7 << FUNNEL_HOLDTIME_SHFT) #define FUNNEL_ENSx_MASK 0xff +DEFINE_CORESIGHT_DEVLIST(funnel_devs, "funnel"); + /** * struct funnel_drvdata - specifics associated to a funnel component * @base: memory mapped base address for this component. @@ -189,6 +191,10 @@ static int funnel_probe(struct amba_device *adev, const struct amba_id *id) pdata = coresight_get_platform_data(dev); if (IS_ERR(pdata)) return PTR_ERR(pdata); + pdata->name = coresight_alloc_device_name(&funnel_devs, dev); + if (!pdata->name) + return -ENOMEM; + adev->dev.platform_data = pdata; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c index 7eb3bf7..7b937c0 100644 --- a/drivers/hwtracing/coresight/coresight-replicator.c +++ b/drivers/hwtracing/coresight/coresight-replicator.c @@ -22,6 +22,8 @@ #define REPLICATOR_IDFILTER0 0x000 #define REPLICATOR_IDFILTER1 0x004 +DEFINE_CORESIGHT_DEVLIST(replicator_devs, "replicator"); + /** * struct replicator_drvdata - specifics associated to a replicator component * @base: memory mapped base address for this component. Also indicates @@ -184,6 +186,11 @@ static int replicator_probe(struct device *dev, struct resource *res) return PTR_ERR(pdata); dev->platform_data = pdata; + pdata->name = coresight_alloc_device_name(&replicator_devs, dev); + + if (!pdata->name) + return -ENOMEM; + drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) return -ENOMEM; diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c index 6514586..d94ae22 100644 --- a/drivers/hwtracing/coresight/coresight-stm.c +++ b/drivers/hwtracing/coresight/coresight-stm.c @@ -107,6 +107,8 @@ struct channel_space { unsigned long *guaranteed; }; +DEFINE_CORESIGHT_DEVLIST(stm_devs, "stm"); + /** * struct stm_drvdata - specifics associated to an STM component * @base: memory mapped base address for this component. @@ -813,6 +815,10 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id) pdata = coresight_get_platform_data(dev); if (IS_ERR(pdata)) return PTR_ERR(pdata); + pdata->name = coresight_alloc_device_name(&stm_devs, dev); + if (!pdata->name) + return -ENOMEM; + adev->dev.platform_data = pdata; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c index 147ab17..030303d 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.c +++ b/drivers/hwtracing/coresight/coresight-tmc.c @@ -25,6 +25,10 @@ #include "coresight-priv.h" #include "coresight-tmc.h" +DEFINE_CORESIGHT_DEVLIST(etb_devs, "tmc_etb"); +DEFINE_CORESIGHT_DEVLIST(etf_devs, "tmc_etf"); +DEFINE_CORESIGHT_DEVLIST(etr_devs, "tmc_etr"); + void tmc_wait_for_tmcready(struct tmc_drvdata *drvdata) { /* Ensure formatter, unformatter and hardware fifo are empty */ @@ -394,6 +398,7 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) struct tmc_drvdata *drvdata; struct resource *res = &adev->res; struct coresight_desc desc = { 0 }; + struct coresight_dev_list *dev_list = NULL; pdata = coresight_get_platform_data(dev); if (IS_ERR(pdata)) { @@ -440,6 +445,7 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) desc.type = CORESIGHT_DEV_TYPE_SINK; desc.subtype.sink_subtype = CORESIGHT_DEV_SUBTYPE_SINK_BUFFER; desc.ops = &tmc_etb_cs_ops; + dev_list = &etb_devs; break; case TMC_CONFIG_TYPE_ETR: desc.type = CORESIGHT_DEV_TYPE_SINK; @@ -449,11 +455,13 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) coresight_get_uci_data(id)); if (ret) goto out; + dev_list = &etr_devs; break; case TMC_CONFIG_TYPE_ETF: desc.type = CORESIGHT_DEV_TYPE_LINKSINK; desc.subtype.link_subtype = CORESIGHT_DEV_SUBTYPE_LINK_FIFO; desc.ops = &tmc_etf_cs_ops; + dev_list = &etf_devs; break; default: pr_err("%s: Unsupported TMC config\n", pdata->name); @@ -461,6 +469,12 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) goto out; } + pdata->name = coresight_alloc_device_name(dev_list, dev); + if (!pdata->name) { + ret = -ENOMEM; + goto out; + } + drvdata->csdev = coresight_register(&desc); if (IS_ERR(drvdata->csdev)) { ret = PTR_ERR(drvdata->csdev); diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c index 18a749a..f5cc457 100644 --- a/drivers/hwtracing/coresight/coresight-tpiu.c +++ b/drivers/hwtracing/coresight/coresight-tpiu.c @@ -46,6 +46,8 @@ #define FFCR_FON_MAN BIT(6) #define FFCR_STOP_FI BIT(12) +DEFINE_CORESIGHT_DEVLIST(tpiu_devs, "tpiu"); + /** * @base: memory mapped base address for this component. * @dev: the coresight device entity associated to this component. @@ -124,6 +126,10 @@ static int tpiu_probe(struct amba_device *adev, const struct amba_id *id) pdata = coresight_get_platform_data(dev); if (IS_ERR(pdata)) return PTR_ERR(pdata); + pdata->name = coresight_alloc_device_name(&tpiu_devs, dev); + if (!pdata->name) + return -ENOMEM; + adev->dev.platform_data = pdata; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 9cdedab..ca40c55 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -1253,3 +1253,61 @@ void coresight_unregister(struct coresight_device *csdev) device_unregister(&csdev->dev); } EXPORT_SYMBOL_GPL(coresight_unregister); + + +/* + * coresight_search_device_idx - Search the fwnode handle of a device + * in the given dev_idx list. Must be called with the coresight_mutex held. + * + * Returns the index of the entry, when found. Otherwise, -ENOENT. + */ +static inline int coresight_search_device_idx(struct coresight_dev_list *dict, + struct fwnode_handle *fwnode) +{ + int i; + + for (i = 0; i < dict->nr_idx; i++) + if (dict->fwnode_list[i] == fwnode) + return i; + return -ENOENT; +} + +/* + * coresight_alloc_device_name - Get an index for a given device in the + * device index list specific to a driver. An index is allocated for a + * device and is tracked with the fwnode_handle to prevent allocating + * duplicate indices for the same device (e.g, if we defer probing of + * a device due to dependencies), in case the index is requested again. + */ +char *coresight_alloc_device_name(struct coresight_dev_list *dict, + struct device *dev) +{ + int idx; + char *name = NULL; + struct fwnode_handle **list; + + mutex_lock(&coresight_mutex); + + idx = coresight_search_device_idx(dict, dev_fwnode(dev)); + if (idx < 0) { + /* Make space for the new entry */ + idx = dict->nr_idx; + list = krealloc(dict->fwnode_list, + (idx + 1) * sizeof(*dict->fwnode_list), + GFP_KERNEL); + if (ZERO_OR_NULL_PTR(list)) { + idx = -ENOMEM; + goto done; + } + + list[idx] = dev_fwnode(dev); + dict->fwnode_list = list; + dict->nr_idx = idx + 1; + } + + name = devm_kasprintf(dev, GFP_KERNEL, "%s%d", dict->pfx, idx); +done: + mutex_unlock(&coresight_mutex); + return name; +} +EXPORT_SYMBOL_GPL(coresight_alloc_device_name); diff --git a/include/linux/coresight.h b/include/linux/coresight.h index 76c31b2..9d933bb 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -174,6 +174,28 @@ struct coresight_device { struct dev_ext_attribute *ea; }; +/* + * coresight_dev_list - Mapping for devices to "name" index for device + * names. + * + * @nr_idx: Number of entries already allocated. + * @pfx: Prefix pattern for device name. + * @fwnode_list: Array of fwnode_handles associated with each allocated + * index, upto nr_idx entries. + */ +struct coresight_dev_list { + int nr_idx; + const char *pfx; + struct fwnode_handle **fwnode_list; +}; + +#define DEFINE_CORESIGHT_DEVLIST(var, dev_pfx) \ +static struct coresight_dev_list (var) = { \ + .pfx = dev_pfx, \ + .nr_idx = 0, \ + .fwnode_list = NULL, \ +} + #define to_coresight_device(d) container_of(d, struct coresight_device, dev) #define source_ops(csdev) csdev->ops->source_ops @@ -266,7 +288,8 @@ extern int coresight_claim_device_unlocked(void __iomem *base); extern void coresight_disclaim_device(void __iomem *base); extern void coresight_disclaim_device_unlocked(void __iomem *base); - +extern char *coresight_alloc_device_name(struct coresight_dev_list *devs, + struct device *dev); #else static inline struct coresight_device * coresight_register(struct coresight_desc *desc) { return NULL; } From patchwork Wed Mar 20 18:49:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 160713 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp626063jan; Wed, 20 Mar 2019 11:50:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqzvkSMnVq3LR+s5EsYwN/ZDYXOc9MyZ3fqB4Cg85Ax0PIRKgPNYYCwP4mxXaX5HfljuGkOY X-Received: by 2002:a63:d4f:: with SMTP id 15mr8818456pgn.162.1553107853891; Wed, 20 Mar 2019 11:50:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553107853; cv=none; d=google.com; s=arc-20160816; b=ixMiRnwUlw9ZnML6tekVq008+W3WfW/OStG1ajY3CbAeADrP5RoWyX/8NHKOe6esP3 8E6a0Ovxe/pfFak+qvEjAmWXVE40Y/VSLBCnWT1m8fkBFOe4OEKbkJq4NlmiBzUei5VP O4L/OE1FZ9B5ZML5JKzawsTjIajqczGvnsm9y1brlw8mrNQ5LSQv/1uhQWBICSP+HRYM jXOZlH5LOthDmIxkEd0KmKGdS9gmqbJ2th27RMNLmo+2GQ+F/RvDj0kkFYw5H02aci3N EQ7+9+VOJquzOwNaFpUNiPL3N3lkjPoJJGVzXZR1tm9ZDECNBoeySSljFmQNxQRdhMjQ ff9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=mh91yunodMV/wO59NXNy3f12yaXyNLtubruvJGoQ9LA=; b=tJyayJaxakMRWEhT+BzPzHgz2yC5unzsbGra7TVmnSPR59T6wtId6fJ7cj93MxbDGU KQk1VjncrZ8qLds5M2NIJ2XIWvz8QIWWg7seSiXSJ2R1YMoDZZK5ZXyyLI5CTrvE5Vpq aNsSF0K3b5RAf6ehyofmvYSl7Ytl+FVboLOlh2faxRWMklr8lgogvjpl7zTPqzrlLrtT IRD09J7IN201cbAQo4PUbhpCa/3GSmddrrnu18LwBJTFWWDXWoa8+fqIckKG+8uwUWie N7++iTScnC5T4Wn3qDTh3bTbMl0r7DiQ2pY+xqMAMVaiidYv7gqZNV8Rq+FaqPKK2ymF JJ7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d11si2367991pls.255.2019.03.20.11.50.53; Wed, 20 Mar 2019 11:50:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727710AbfCTSuw (ORCPT + 31 others); Wed, 20 Mar 2019 14:50:52 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:45046 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727696AbfCTSuu (ORCPT ); Wed, 20 Mar 2019 14:50:50 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9D0161A25; Wed, 20 Mar 2019 11:50:49 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id F41563F59C; Wed, 20 Mar 2019 11:50:47 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, coresight@lists.linaro.org, mike.leach@linaro.org, robert.walker@arm.com, Suzuki K Poulose , Mathieu Poirier , "Rafael J. Wysocki" Subject: [PATCH 23/25] coresight: stm: ACPI support for parsing stimulus base Date: Wed, 20 Mar 2019 18:49:40 +0000 Message-Id: <1553107783-3340-24-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> References: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The stimulus base for STM device must be listed as the second memory resource, followed by the programming base address. Add support for parsing the information for ACPI. Cc: Mathieu Poirier Cc: "Rafael J. Wysocki" Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-stm.c | 43 +++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c index d94ae22..995443a 100644 --- a/drivers/hwtracing/coresight/coresight-stm.c +++ b/drivers/hwtracing/coresight/coresight-stm.c @@ -16,6 +16,7 @@ * (C) 2015-2016 Chunyan Zhang */ #include +#include #include #include #include @@ -717,10 +718,52 @@ static inline int of_stm_get_stimulus_area(struct device *dev, } #endif +#ifdef CONFIG_ACPI +static int acpi_stm_get_stimulus_area(struct device *dev, struct resource *res) +{ + int rc; + bool found_base = false; + struct resource_entry *rent; + LIST_HEAD(res_list); + + struct acpi_device *adev = ACPI_COMPANION(dev); + + if (!adev) + return -ENODEV; + rc = acpi_dev_get_resources(adev, &res_list, NULL, NULL); + if (rc < 0) + return rc; + + rc = -ENOENT; + list_for_each_entry(rent, &res_list, node) { + if (resource_type(rent->res) != IORESOURCE_MEM) + continue; + if (found_base) { + *res = *rent->res; + rc = 0; + break; + } + + found_base = true; + } + + acpi_dev_free_resource_list(&res_list); + return rc; +} +#else +static inline int acpi_stm_get_stimulus_area(struct device *dev, + struct resource *res) +{ + return -ENOENT; +} +#endif + static int stm_get_stimulus_area(struct device *dev, struct resource *res) { if (dev->of_node) return of_stm_get_stimulus_area(dev, res); + else if (is_acpi_node(dev->fwnode)) + return acpi_stm_get_stimulus_area(dev, res); return -ENOENT; } From patchwork Wed Mar 20 18:49:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 160715 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp626116jan; Wed, 20 Mar 2019 11:50:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwUQz1OoxQihfbc08VIhsiu6cGwExm6GHfohTpaPv6xbWuz65fRVU9TgPf7HktoAenGV2HO X-Received: by 2002:a17:902:8a96:: with SMTP id p22mr9349511plo.113.1553107858065; Wed, 20 Mar 2019 11:50:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553107858; cv=none; d=google.com; s=arc-20160816; b=Wrn6iP7Q69wT1aa2sThw0M7myPQYWleElSlhgki1b37iYHAHWXpFBsw7p23pcsd3xj jzDS8dkevsvSl0Bkp3RU65gZkypgAuIrGeW25uFHfzmdmn+lyQGYb3T+9kA1HNSJDlum QcfIqImyk6sRL3zGqeh6LDQXsskbyw72mvfxEWienCnqmjH2u3+3s2j0fCVaDLbwpgmm HMNeBwdCyhEcoGXSiJQGqMA7+dsHlMEjXknM396iTGpxTTAa/vmUxjTsFkywtFVeXbhG PPsoMve9Y/09dqxpvb5u1tUaw768JefFjKXo6xY81FME+PZz3aNdiNLNNCWQoj2O/PVI fNSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=BgAbWgYWX0dKcACX3J8SIGcRoJA5qhZot/I55dQMYiA=; b=sS8JYB4YaAbIsyP+sHC5wL08Gg6AduUz0y77duseNivPVn9XRfl7OAUoXhc4WU8Dj5 iTyS3WLESKyW9V6dK1vZcrdwWMPW9o0OM0UP/+QkVq908ngpPYkneV9WYLj+pb8rPOL6 OuTB3xV7/l9XaXep/bqnM5mCWC0rEv10XO4ScVw8GJHWYpIe0Ws48eJuhLi7cV2M3YCZ jDz8wraflyzxotQIP0oFEh015iTm/rgzjefJDmdon9AtBBl5zr8rGJ/336gVnkKC4lhk IyaDnBYLvsx7lQ5l9ynRIIvDaAmu9eBxIvNETjczAd7MNr3fZ/P9ZaqGiFyEzFEoloYr vM8w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a19si2185037pgw.244.2019.03.20.11.50.57; Wed, 20 Mar 2019 11:50:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727742AbfCTSu4 (ORCPT + 31 others); Wed, 20 Mar 2019 14:50:56 -0400 Received: from foss.arm.com ([217.140.101.70]:45066 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727717AbfCTSux (ORCPT ); Wed, 20 Mar 2019 14:50:53 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 689DA1BC0; Wed, 20 Mar 2019 11:50:53 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BFEFF3F59C; Wed, 20 Mar 2019 11:50:51 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, coresight@lists.linaro.org, mike.leach@linaro.org, robert.walker@arm.com, Suzuki K Poulose , "Rafael J. Wysocki" , Mathieu Poirier Subject: [PATCH 25/25] coresight: acpi: Support for components Date: Wed, 20 Mar 2019 18:49:42 +0000 Message-Id: <1553107783-3340-26-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> References: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All AMBA devices are handled via ACPI AMBA scan notifier infrastructure. The platform devices get the ACPI id added to their driver. Cc: "Rafael J. Wysocki" Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/acpi/acpi_amba.c | 9 +++++++++ drivers/hwtracing/coresight/coresight-replicator.c | 9 ++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/acpi/acpi_amba.c b/drivers/acpi/acpi_amba.c index 7f77c07..eef5a69 100644 --- a/drivers/acpi/acpi_amba.c +++ b/drivers/acpi/acpi_amba.c @@ -24,6 +24,15 @@ static const struct acpi_device_id amba_id_list[] = { {"ARMH0061", 0}, /* PL061 GPIO Device */ + {"ARMHC500", 0}, /* ARM CoreSight ETM4x */ + {"ARMHC501", 0}, /* ARM CoreSight ETR */ + {"ARMHC502", 0}, /* ARM CoreSight STM */ + {"ARMHC503", 0}, /* ARM CoreSight Debug */ + {"ARMHC979", 0}, /* ARM CoreSight TPIU */ + {"ARMHC97C", 0}, /* ARM CoreSight SoC-400 TMC, SoC-600 ETF/ETB */ + {"ARMHC98D", 0}, /* ARM CoreSight Dynamic Replicator */ + {"ARMHC9CA", 0}, /* ARM CoreSight CATU */ + {"ARMHC9FF", 0}, /* ARM CoreSight Funnel */ {"", 0}, }; diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c index 7b937c0..11b1978 100644 --- a/drivers/hwtracing/coresight/coresight-replicator.c +++ b/drivers/hwtracing/coresight/coresight-replicator.c @@ -5,6 +5,7 @@ * Description: CoreSight Replicator driver */ +#include #include #include #include @@ -288,11 +289,17 @@ static const struct of_device_id static_replicator_match[] = { {} }; +#ifdef CONFIG_ACPI +static const struct acpi_device_id static_replicator_acpi_ids[] = { + {"ARMHC985", 0}, /* ARM CoreSight Static Replicator */ +}; +#endif static struct platform_driver static_replicator_driver = { .probe = static_replicator_probe, .driver = { .name = "coresight-replicator", - .of_match_table = static_replicator_match, + .of_match_table = of_match_ptr(static_replicator_match), + .acpi_match_table = ACPI_PTR(static_replicator_acpi_ids), .pm = &replicator_dev_pm_ops, .suppress_bind_attrs = true, }, From patchwork Wed Mar 20 18:49:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 160716 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp626195jan; Wed, 20 Mar 2019 11:51:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwPD9ZNGInmLdAaNxr3dE+OQ1/B0O3kAkHHdtYLCkHCGhgIDi1h5jzlpiv9XC9f3TUUOTpD X-Received: by 2002:a65:508b:: with SMTP id r11mr8861202pgp.242.1553107863885; Wed, 20 Mar 2019 11:51:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553107863; cv=none; d=google.com; s=arc-20160816; b=ogBml8+2Bg30vg6f8m302D+bk7QfnLoAgeU3U46wSYPSqitJP00+YWIsBkrak/BuPd tXyFkKSTYB4x4mQ+aA1IIEICCnplaFoqjf3Z4TBttlsTKapprlCKeZU1pdCb+9FnU25G AcqxL+kQS3QtIYIFt0xkTfohctQnpPZhcHG1jjrHqkB71VJdQbgfSyK15aEoaWjSVlv6 Ej4Z1YsEWqoFgmJcMqjgcThZClhequ3W6nBsy05iaTdJ+MGFzByzRCKMRJ20BB+vIihb XECR30FJNayq6/pkrL5rEMZTOTOVvmUVLgEz7untNTTJouqX5u+aSL5w6MZFck7pbiBU z2Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=VYrdyVdXitr0IukJNDx1qYS4TusT1Vc6l7Tt7/OvRJU=; b=Q3vmYujDd5PN/U+/IcJK0hieEpunZxsZ8xmhYGpBHrevtNmNEYV3zuRn/35J0+xdW5 vXOALHZ0f0/Yd4wQ+9fVn9P32g4jQ5MbKDpqn7dqHL2fPg1UyNIIQnyHfS0TgelrsvHJ yce/8JL32bIQCkZH003juhP5s9IzfREoJS9s0ENNrf0JJAxRgTo5YaxFwtg/CtqaO1v3 i0AIjpwZZ6T+LwSJIRyuoH2ZA81Mg2c/tMgdrR3Tjw3+Od3gKZpHRw4p116DgiwKZUw1 ohVVYPxdNOfNoncY3zFy+Of9DqNlPPdgYwV18nhQPj/29rGcC/mbjfpfv980yXZW76rn ZmGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x23si2254282pfe.141.2019.03.20.11.51.03; Wed, 20 Mar 2019 11:51:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727755AbfCTSvC (ORCPT + 31 others); Wed, 20 Mar 2019 14:51:02 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:45084 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727726AbfCTSuz (ORCPT ); Wed, 20 Mar 2019 14:50:55 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 06E29A78; Wed, 20 Mar 2019 11:50:55 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A55173F59C; Wed, 20 Mar 2019 11:50:53 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, coresight@lists.linaro.org, mike.leach@linaro.org, robert.walker@arm.com, Suzuki K Poulose Subject: [TEST PATCH 26/25] edk2-platform: juno: Update ACPI CoreSight Bindings Date: Wed, 20 Mar 2019 18:49:43 +0000 Message-Id: <1553107783-3340-27-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> References: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ACPI bindings for CoreSight components on the Juno-r0 board. Please note that the bindings apply only for the juno-r0. The layout on r1 and r2 are slightly different and will need dynamic ACPI table support to be able to use a single UEFI image. Signed-off-by: Suzuki K Poulose --- Platform/ARM/JunoPkg/AcpiTables/Dsdt.asl | 241 +++++++++++++++++++++++++++++++ 1 file changed, 241 insertions(+) -- 2.7.4 diff --git a/Platform/ARM/JunoPkg/AcpiTables/Dsdt.asl b/Platform/ARM/JunoPkg/AcpiTables/Dsdt.asl index 702b057..c70e8ac 100644 --- a/Platform/ARM/JunoPkg/AcpiTables/Dsdt.asl +++ b/Platform/ARM/JunoPkg/AcpiTables/Dsdt.asl @@ -14,6 +14,51 @@ #include "ArmPlatform.h" +#define ACPI_GRAPH_REV 0 +#define ACPI_GRAPH_UUID "ab02a46b-74c7-45a2-bd68-f7d344ef2153" + +#define CORESIGHT_GRAPH_UUID "3ecbc8b6-1d0e-4fb3-8107-e627f805c6cd" + +#define CS_LINK_MASTER 1 +#define CS_LINK_SLAVE 0 + + +#define DSD_CS_GRAPH_BEGIN(_nports) \ + Package () { \ + 1, // GraphID \ + ToUUID(CORESIGHT_GRAPH_UUID), \ + _nports, + +#define DSD_CS_GRAPH_END \ + } + +#define DSD_GRAPH_BEGIN(_nports) \ + ToUUID(ACPI_GRAPH_UUID), \ + Package() { \ + ACPI_GRAPH_REV, \ + 1, \ + DSD_CS_GRAPH_BEGIN(_nports) + +#define DSD_GRAPH_END \ + DSD_CS_GRAPH_END \ + } + +#define DSD_PORTS_BEGIN(_nports) \ + Name (_DSD, Package () { \ + DSD_GRAPH_BEGIN(_nports) + +#define DSD_PORTS_END \ + DSD_GRAPH_END \ + }) + +#define CS_PORT(_port, _rport, _rphandle, _dir) \ + Package () { _port, _rport, _rphandle, _dir} + +#define CS_INPUT_PORT(_port, _rport, _rphandle) \ + CS_PORT(_port, _rport, _rphandle, CS_LINK_SLAVE) +#define CS_OUTPUT_PORT(_port, _rport, _rphandle) \ + CS_PORT(_port, _rport, _rphandle, CS_LINK_MASTER) + DefinitionBlock("DsdtTable.aml", "DSDT", 1, "ARMLTD", "ARM-JUNO", EFI_ACPI_ARM_OEM_REVISION) { Scope(_SB) { // @@ -122,15 +167,56 @@ DefinitionBlock("DsdtTable.aml", "DSDT", 1, "ARMLTD", "ARM-JUNO", EFI_ACPI_ARM_O Method (_LPI, 0, NotSerialized) { return(PLPI) } + + Device(ETM0) { // ETM on Cluster0 CPU0 + Name (_HID, "ARMHC500") + Name (_CID, "ARMHC500") + Name (_CRS, ResourceTemplate() { + Memory32Fixed(ReadWrite, 0x22040000, 0x1000) + }) + + DSD_PORTS_BEGIN(1) + CS_OUTPUT_PORT(0, 0, \_SB_.CLU0.FUN0) + DSD_PORTS_END + + } // ETM0 } + Device(CPU1) { // A57-1: Cluster 0, Cpu 1 Name(_HID, "ACPI0007") Name(_UID, 5) Method (_LPI, 0, NotSerialized) { return(PLPI) } + Device(ETM1) { // ETM on Cluster0 CPU1 + Name (_HID, "ARMHC500") + Name (_CID, "ARMHC500") + Name (_CRS, ResourceTemplate() { + Memory32Fixed(ReadWrite, 0x22140000, 0x1000) + }) + + DSD_PORTS_BEGIN(1) + CS_OUTPUT_PORT(0, 1, \_SB_.CLU0.FUN0) + DSD_PORTS_END + + } // ETM1 } + + Device(FUN0) { + Name(_HID, "ARMHC9FF") + Name(_CID, "ARMHC9FF") + Name(_CRS, ResourceTemplate() { + Memory32Fixed(ReadWrite, 0x220c0000, 0x1000) + }) + + DSD_PORTS_BEGIN(3) + CS_OUTPUT_PORT(0, 0, \_SB_.MFUN), + CS_INPUT_PORT(0, 0, \_SB_.CLU0.CPU0.ETM0), + CS_INPUT_PORT(1, 0, \_SB_.CLU0.CPU1.ETM1) + DSD_PORTS_END + } // CL0.FUN0 } + Device (CLU1) { // Cluster1 state Name(_HID, "ACPI0010") Name(_UID, 2) @@ -208,19 +294,45 @@ DefinitionBlock("DsdtTable.aml", "DSDT", 1, "ARMLTD", "ARM-JUNO", EFI_ACPI_ARM_O "CorePwrDn" }, }) + Device(CPU2) { // A53-0: Cluster 1, Cpu 0 Name(_HID, "ACPI0007") Name(_UID, 0) Method (_LPI, 0, NotSerialized) { return(PLPI) } + Device(ETM2) { // ETM on Cluster1, CPU0 + Name (_HID, "ARMHC500") + Name (_CID, "ARMHC500") + Name (_CRS, ResourceTemplate() { + Memory32Fixed(ReadWrite, 0x23040000, 0x1000) + }) + + DSD_PORTS_BEGIN(1) + CS_OUTPUT_PORT(0, 0, \_SB_.CLU1.FUN1) + DSD_PORTS_END + + } // ETM2 } + Device(CPU3) { // A53-1: Cluster 1, Cpu 1 Name(_HID, "ACPI0007") Name(_UID, 1) Method (_LPI, 0, NotSerialized) { return(PLPI) } + Device(ETM3) { // ETM on Cluster1, CPU1 + Name (_HID, "ARMHC500") + Name (_CID, "ARMHC500") + Name (_CRS, ResourceTemplate() { + Memory32Fixed(ReadWrite, 0x23140000, 0x1000) + }) + + DSD_PORTS_BEGIN(1) + CS_OUTPUT_PORT(0, 1, \_SB_.CLU1.FUN1) + DSD_PORTS_END + + } // ETM3 } Device(CPU4) { // A53-2: Cluster 1, Cpu 2 Name(_HID, "ACPI0007") @@ -228,6 +340,18 @@ DefinitionBlock("DsdtTable.aml", "DSDT", 1, "ARMLTD", "ARM-JUNO", EFI_ACPI_ARM_O Method (_LPI, 0, NotSerialized) { return(PLPI) } + Device(ETM4) { // ETM on Cluster1, CPU2 + Name (_HID, "ARMHC500") // ETM + Name (_CID, "ARMHC500") // ETM + Name (_CRS, ResourceTemplate() { + Memory32Fixed(ReadWrite, 0x23240000, 0x1000) + }) + + DSD_PORTS_BEGIN(1) + CS_OUTPUT_PORT(0, 2, \_SB_.CLU1.FUN1) + DSD_PORTS_END + + } // ETM4 } Device(CPU5) { // A53-3: Cluster 1, Cpu 3 Name(_HID, "ACPI0007") @@ -235,9 +359,126 @@ DefinitionBlock("DsdtTable.aml", "DSDT", 1, "ARMLTD", "ARM-JUNO", EFI_ACPI_ARM_O Method (_LPI, 0, NotSerialized) { return(PLPI) } + Device(ETM5) { // ETM on Cluster1, CPU3 + Name (_HID, "ARMHC500") // ETM + Name (_CID, "ARMHC500") // ETM + Name (_CRS, ResourceTemplate() { + Memory32Fixed(ReadWrite, 0x23340000, 0x1000) + }) + + DSD_PORTS_BEGIN(1) + CS_OUTPUT_PORT(0, 3, \_SB_.CLU1.FUN1) + DSD_PORTS_END + } // ETM5 } + Device(FUN1) { + Name(_HID, "ARMHC9FF") + Name(_CID, "ARMHC9FF") + Name(_CRS, ResourceTemplate() { + Memory32Fixed(ReadWrite, 0x230c0000, 0x1000) + }) + + DSD_PORTS_BEGIN(5) + CS_OUTPUT_PORT(0, 1, \_SB_.MFUN), + CS_INPUT_PORT(0, 0, \_SB_.CLU1.CPU2.ETM2), + CS_INPUT_PORT(1, 0, \_SB_.CLU1.CPU3.ETM3), + CS_INPUT_PORT(2, 0, \_SB_.CLU1.CPU4.ETM4), + CS_INPUT_PORT(3, 0, \_SB_.CLU1.CPU5.ETM5) + DSD_PORTS_END + } // CL1.FUN1 } + Device(STM0) { + Name(_HID, "ARMHC502") // STM + Name(_CID, "ARMHC502") + Name(_CRS, ResourceTemplate() { + Memory32Fixed(ReadWrite, 0x20100000, 0x1000) + Memory32Fixed(ReadWrite, 0x28000000, 0x1000000) + }) + DSD_PORTS_BEGIN(1) + CS_OUTPUT_PORT(0, 2, \_SB_.MFUN) + DSD_PORTS_END + } + + Device(MFUN) { + Name(_HID, "ARMHC9FF") // Funnel + Name(_CID, "ARMHC9FF") // Funnel + Name(_CRS, ResourceTemplate() { + Memory32Fixed(ReadWrite, 0x20040000, 0x1000) + }) + + DSD_PORTS_BEGIN(4) + CS_OUTPUT_PORT(0, 0, \_SB_.ETF0), + CS_INPUT_PORT(0, 0, \_SB_.CLU0.FUN0), + CS_INPUT_PORT(1, 0, \_SB_.CLU1.FUN1), + CS_INPUT_PORT(2, 0, \_SB_.STM0) + DSD_PORTS_END + + } // MFUN-nel + + Device(ETF0) { + Name(_HID, "ARMHC97C") // TMC + Name(_CID, "ARMHC97C") // TMC + Name(_CRS, ResourceTemplate() { + Memory32Fixed(ReadWrite, 0x20010000, 0x1000) + }) + + DSD_PORTS_BEGIN(2) + CS_OUTPUT_PORT(0, 1, \_SB_.RPL), + CS_INPUT_PORT(0, 0, \_SB_.MFUN) + DSD_PORTS_END + + } // ETF0 + + Device(RPL) { + Name(_HID, "ARMHC98D") // Replicator + Name(_CID, "ARMHC98D") // Replicator + Name(_CRS, ResourceTemplate() { + Memory32Fixed(ReadWrite, 0x20120000, 0x1000) + }) + + DSD_PORTS_BEGIN(3) + CS_OUTPUT_PORT(0, 0, \_SB_.TPIU), + CS_OUTPUT_PORT(1, 0, \_SB_.ETR), + CS_INPUT_PORT(0, 0, \_SB_.ETF0) + DSD_PORTS_END + + } // RPL + + Device(ETR) { + Name(_HID, "ARMHC97C") // TMC + Name(_CID, "ARMHC97C") // TMC + Name(_CCA, 0) // The ETR on this platform is not coherent + Name(_CRS, ResourceTemplate() { + Memory32Fixed(ReadWrite, 0x20070000, 0x1000) + }) + + Name(_DSD, Package() { + DSD_GRAPH_BEGIN(1) + CS_INPUT_PORT(0, 1, \_SB_.RPL) + DSD_GRAPH_END, + + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package() { + Package(2) {"arm,scatter-gather", 1} + } + }) + + } // ETR + + Device(TPIU) { + Name(_HID, "ARMHC979") // TPIU + Name(_CID, "ARMHC979") // TPIU + Name(_CRS, ResourceTemplate() { + Memory32Fixed(ReadWrite, 0x20030000, 0x1000) + }) + + DSD_PORTS_BEGIN(1) + CS_INPUT_PORT(0, 0, \_SB_.RPL) + DSD_PORTS_END + + } // TPIU + // // Keyboard and Mouse //